summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/OXx/Encoding.pm19
-rw-r--r--lib/OXx/Encoding/Role/Request.pm19
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,
+ },
+ );
};
}