diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-10-03 03:24:34 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-10-03 03:24:34 -0500 |
commit | 8abee86bd5ac48c9885813b3d1a6a56d42062afb (patch) | |
tree | 9396f2881126a59dd976864d3ee2f2bdf0021e8c /lib/OXx/Encoding.pm | |
parent | 2721fc69404c79d034ea9d3c0f4636921c0d68e1 (diff) | |
download | oxx-encoding-8abee86bd5ac48c9885813b3d1a6a56d42062afb.tar.gz oxx-encoding-8abee86bd5ac48c9885813b3d1a6a56d42062afb.zip |
initial implementation
Diffstat (limited to 'lib/OXx/Encoding.pm')
-rw-r--r-- | lib/OXx/Encoding.pm | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/OXx/Encoding.pm b/lib/OXx/Encoding.pm index e69de29..729c5a3 100644 --- a/lib/OXx/Encoding.pm +++ b/lib/OXx/Encoding.pm @@ -0,0 +1,40 @@ +package OXx::Encoding; +use MooseX::Role::Parameterized; +use namespace::autoclean; + +use OXx::Encoding::Types; + +parameter encoding => ( + isa => 'Encoding', + required => 1, +); + +parameter html_encoding => ( + isa => 'Str', + lazy => 1, + default => sub { shift->encoding }, +); + +role { + my $p = shift; + + around request_class => sub { + my $orig = shift; + my $self = shift; + + my $super = $self->$orig(@_); + + return Moose::Meta::Class->create_anon_class( + superclasses => [$super], + roles => [ + 'OXx::Encoding::Role::Request' => { + encoding => $p->encoding, + html_encoding => $p->html_encoding, + }, + ], + cache => 1, + )->name; + }; +} + +1; |