From 2b83702afe0f845311fedae8d71b6b51dd5f7f2c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 3 Oct 2011 22:58:51 -0500 Subject: oh yeah, this exists --- lib/OXx/Encoding/Role/Request.pm | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'lib/OXx/Encoding/Role/Request.pm') 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, + }, + ); }; } -- cgit v1.2.3-54-g00ecf