From: Shawn M Moore Date: Tue, 25 Nov 2008 06:10:30 +0000 (+0000) Subject: Be more consistent with the Moose::Meta::Class->create($package, %opts) api X-Git-Tag: 0.62~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d5f3fab739bb56745a139537b56f187b3f57cb4;p=gitmo%2FMoose.git Be more consistent with the Moose::Meta::Class->create($package, %opts) api --- diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index 8d47ab4..7e44f09 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -476,12 +476,9 @@ sub combine { } sub create { - my ( $role, @args ) = @_; + my ( $role, $package_name, %options ) = @_; - unshift @args, 'package' if @args % 2 == 1; - - my (%options) = @args; - my $package_name = $options{package}; + $options{package} = $package_name; (ref $options{attributes} eq 'HASH') || confess "You must pass a HASH ref of attributes" @@ -493,7 +490,7 @@ sub create { $role->SUPER::create(%options); - my (%initialize_options) = @args; + my (%initialize_options) = %options; delete @initialize_options{qw( package attributes diff --git a/t/030_roles/034_create_role.t b/t/030_roles/034_create_role.t index 8c1df50..089b8f8 100644 --- a/t/030_roles/034_create_role.t +++ b/t/030_roles/034_create_role.t @@ -5,7 +5,7 @@ use Test::More tests => 4; use Moose (); my $role = Moose::Meta::Role->create( - 'package' => 'MyItem::Role::Equipment', + 'MyItem::Role::Equipment', attributes => { is_worn => { is => 'rw',