}
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"
$role->SUPER::create(%options);
- my (%initialize_options) = @args;
+ my (%initialize_options) = %options;
delete @initialize_options{qw(
package
attributes
use Moose ();
my $role = Moose::Meta::Role->create(
- 'package' => 'MyItem::Role::Equipment',
+ 'MyItem::Role::Equipment',
attributes => {
is_worn => {
is => 'rw',