From: Shawn M Moore Date: Wed, 26 Nov 2008 07:52:29 +0000 (+0000) Subject: Allow passing in an already constructed parameter object X-Git-Tag: 0.05~60 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=58954f3ec91fd6b965a32d9b0d007e44ac1c73ea;p=gitmo%2FMooseX-Role-Parameterized.git Allow passing in an already constructed parameter object --- diff --git a/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm b/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm index 0b9b566..6aa19de 100644 --- a/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm +++ b/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm @@ -37,13 +37,13 @@ sub construct_parameters { sub generate_role { my $self = shift; - my %args = @_; + + my $parameters = @_ == 1 ? shift + : $self->construct_parameters(@_); confess "A role generator is required to generate roles" unless $self->has_role_generator; - my $parameters = $self->construct_parameters(%args); - my $role = $self->parameterized_role_metaclass->create_anon_role(parameters => $parameters); local $MooseX::Role::Parameterized::CURRENT_METACLASS = $role;