From: Dave Rolsky Date: Mon, 4 Apr 2011 04:05:20 +0000 (-0500) Subject: Need to capture new class/role after applying metaroles X-Git-Tag: 0.12~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6095de21fa00670b76aa68f6cd89465cb49572d3;p=gitmo%2FMooseX-UndefTolerant.git Need to capture new class/role after applying metaroles --- diff --git a/lib/MooseX/UndefTolerant/ApplicationToClass.pm b/lib/MooseX/UndefTolerant/ApplicationToClass.pm index 353858b..b6be5df 100644 --- a/lib/MooseX/UndefTolerant/ApplicationToClass.pm +++ b/lib/MooseX/UndefTolerant/ApplicationToClass.pm @@ -6,7 +6,7 @@ around apply => sub { my $self = shift; my ($role, $class) = @_; - Moose::Util::MetaRole::apply_metaroles( + $class = Moose::Util::MetaRole::apply_metaroles( for => $class, class_metaroles => { class => [ 'MooseX::UndefTolerant::Class' ], diff --git a/lib/MooseX/UndefTolerant/ApplicationToRole.pm b/lib/MooseX/UndefTolerant/ApplicationToRole.pm index 6393923..3cdbe6d 100644 --- a/lib/MooseX/UndefTolerant/ApplicationToRole.pm +++ b/lib/MooseX/UndefTolerant/ApplicationToRole.pm @@ -4,10 +4,10 @@ use Moose::Role; around apply => sub { my $orig = shift; my $self = shift; - my ($role, $class) = @_; + my ($role1, $role2) = @_; - Moose::Util::MetaRole::apply_metaroles( - for => $class, + $role2 = Moose::Util::MetaRole::apply_metaroles( + for => $role2, role_metaroles => { application_to_class => [ 'MooseX::UndefTolerant::ApplicationToClass', @@ -18,7 +18,7 @@ around apply => sub { } ); - $self->$orig( $role, $class ); + $self->$orig( $role1, $role2 ); }; no Moose::Role;