Use Mouse::Object::BUILDARGS, because it's safe and flexible.
[gitmo/Mouse.git] / lib / Mouse / Meta / Role / Composite.pm
index 38b88a5..18745d5 100644 (file)
@@ -50,7 +50,9 @@ sub has_override_method_modifier{
 }
 
 sub add_attribute{
-    my($self, $attr_name, $spec) = @_;
+    my $self      = shift;
+    my $attr_name = shift;
+    my $spec      = (@_ == 1 ? $_[0] : {@_});
 
     my $existing = $self->{attributes}{$attr_name};
     if($existing && $existing != $spec){