'Fix' has '+attr' in roles by exploding earlier.
[gitmo/Moose.git] / lib / Moose / Meta / Role.pm
index 53abe61..adabdeb 100644 (file)
@@ -9,7 +9,7 @@ use Scalar::Util 'blessed';
 use Carp         'confess';
 use Devel::GlobalDestruction 'in_global_destruction';
 
-our $VERSION   = '1.02';
+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(@_);
 }