diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-10-03 22:58:51 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-10-03 22:59:15 -0500 |
commit | 2b83702afe0f845311fedae8d71b6b51dd5f7f2c (patch) | |
tree | 04d5dfbdd57bdb2a498e2e11b3619e07fe99858b /lib/OXx | |
parent | 8abee86bd5ac48c9885813b3d1a6a56d42062afb (diff) | |
download | oxx-encoding-2b83702afe0f845311fedae8d71b6b51dd5f7f2c.tar.gz oxx-encoding-2b83702afe0f845311fedae8d71b6b51dd5f7f2c.zip |
Diffstat (limited to 'lib/OXx')
-rw-r--r-- | lib/OXx/Encoding.pm | 19 | ||||
-rw-r--r-- | lib/OXx/Encoding/Role/Request.pm | 19 |
2 files changed, 14 insertions, 24 deletions
diff --git a/lib/OXx/Encoding.pm b/lib/OXx/Encoding.pm index 729c5a3..8e6103c 100644 --- a/lib/OXx/Encoding.pm +++ b/lib/OXx/Encoding.pm @@ -2,6 +2,7 @@ package OXx::Encoding; use MooseX::Role::Parameterized; use namespace::autoclean; +use Moose::Util 'with_traits'; use OXx::Encoding::Types; parameter encoding => ( @@ -22,18 +23,12 @@ role { 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; + return with_traits($self->$orig(@_), + 'OXx::Encoding::Role::Request' => { + encoding => $p->encoding, + html_encoding => $p->html_encoding, + }, + ); }; } diff --git a/lib/OXx/Encoding/Role/Request.pm b/lib/OXx/Encoding/Role/Request.pm index a41c74b..4f50046 100644 --- a/lib/OXx/Encoding/Role/Request.pm +++ b/lib/OXx/Encoding/Role/Request.pm @@ -3,6 +3,7 @@ use MooseX::Role::Parameterized; use namespace::autoclean; use Encode (); +use Moose::Util 'with_traits'; use OXx::Encoding::Types; parameter encoding => ( @@ -37,18 +38,12 @@ role { my $orig = shift; my $self = shift; - my $super = $self->$orig(@_); - - return Moose::Meta::Class->create_anon_class( - superclasses => [$super], - roles => [ - 'OXx::Encoding::Role::Response' => { - encoding => $p->encoding, - html_encoding => $p->html_encoding, - }, - ], - cache => 1, - )->name; + return with_traits($self->$orig(@_), + 'OXx::Encoding::Role::Response' => { + encoding => $p->encoding, + html_encoding => $p->html_encoding, + }, + ); }; } |