'Fix' has '+attr' in roles by exploding earlier.
[gitmo/Moose.git] / lib / Moose / Meta / Role.pm
index 742ae7c..adabdeb 100644 (file)
@@ -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(@_);
 }