X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse.pm;h=d964a8453ff8043c2d3c38a969b939e2ea2b3fb6;hp=d57d75ed3b93747288ba466b8616580daf3ebbeb;hb=95ecd6f132112c6763cdaf2e6bc72c39e9ab76b5;hpb=9d0686b20ef0bafe5f99c9a9c5e354ff06476f15 diff --git a/lib/Mouse.pm b/lib/Mouse.pm index d57d75e..d964a84 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -46,6 +46,9 @@ sub has { my $meta = Mouse::Meta::Class->initialize(scalar caller); my $name = shift; + $meta->throw_error(q{Usage: has 'name' => ( key => value, ... )}) + if @_ % 2; # odd number of arguments + $meta->add_attribute($_ => @_) for ref($name) ? @{$name} : $name; }