X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FRole.pm;h=adabdebc2bf9d1e132565f7662c0ba52539ff525;hb=576cd474fc09bba92843e299a33dd2634629a930;hp=342ec8c5c27b9e1666d127cb85a3ce118260fdd7;hpb=4bf82ce13be926eca01d6b8f07b46625a98a56fa;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index 342ec8c..adabdeb 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -9,7 +9,7 @@ use Scalar::Util 'blessed'; use Carp 'confess'; use Devel::GlobalDestruction 'in_global_destruction'; -our $VERSION = '0.98'; +our $VERSION = '1.03'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -197,6 +197,9 @@ sub add_attribute { my $class = ref $_[0]; Moose->throw_error( "Cannot add a $class as an attribute to a role" ); } + elsif (!blessed($_[0]) && $_[0] =~ /^\+(.*)/) { + Moose->throw_error( "has '+attr' is not supported in roles" ); + } return $self->SUPER::add_attribute(@_); } @@ -399,7 +402,7 @@ sub alias_method { ## ------------------------------------------------------------------ sub apply { - my ($self, $other, @args) = @_; + my ($self, $other, %args) = @_; (blessed($other)) || Moose->throw_error("You must pass in an blessed instance"); @@ -416,7 +419,7 @@ sub apply { } Class::MOP::load_class($application_class); - return $application_class->new(@args)->apply($self, $other); + return $application_class->new(%args)->apply($self, $other, \%args); } sub composition_class_roles { }