From: Shawn M Moore Date: Sun, 9 Nov 2008 04:33:35 +0000 (+0000) Subject: cleanup of role generation X-Git-Tag: 0.05~102 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1e750b62fd44441ab64d52e606d40ed431ab7815;p=gitmo%2FMooseX-Role-Parameterized.git cleanup of role generation --- diff --git a/lib/MooseX/Role/Parameterized/Meta/Role.pm b/lib/MooseX/Role/Parameterized/Meta/Role.pm index 74f24e0..d98610e 100644 --- a/lib/MooseX/Role/Parameterized/Meta/Role.pm +++ b/lib/MooseX/Role/Parameterized/Meta/Role.pm @@ -39,16 +39,20 @@ sub generate_role { confess "A role generator is required to generate roles" unless $self->has_role_generator; - my $role = Moose::Meta::Class->create_anon_class( + my $metaclass = Moose::Meta::Class->create_anon_class( superclasses => ['Moose::Meta::Role'], ); my $parameters = $self->construct_parameters(%args); - local $MooseX::Role::Parameterized::CURRENT_ROLE = $role; - $self->role_generator->($parameters, $role); + local $MooseX::Role::Parameterized::CURRENT_METACLASS = $metaclass; + $self->role_generator->($parameters, + operating_on => $metaclass, + parameterized_role => $self, + ); - return $role->construct_instance; + my $role = $metaclass->construct_instance; + return $role; } __PACKAGE__->meta->make_immutable;