X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FModule.pm;h=9fefa10379bfc59f493d3af0815d8456baec31b5;hb=fea36fd29b45961b8687f1aee7fd2701c984fae4;hp=1c18447fcb5d8d61b41a1c6273651cf427ddd850;hpb=7eb3a8d52207d71fe91dad750a74c9f04bea568d;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/Module.pm b/lib/Mouse/Meta/Module.pm index 1c18447..9fefa10 100755 --- a/lib/Mouse/Meta/Module.pm +++ b/lib/Mouse/Meta/Module.pm @@ -88,7 +88,7 @@ sub add_method { } if(ref($code) ne 'CODE'){ - not_supported 'add_method for a method object'; + $code = \&{$code}; # coerce } $self->{methods}->{$name}++; # Moose stores meta object here. @@ -115,6 +115,9 @@ sub _code_is_mine{ sub has_method { my($self, $method_name) = @_; + defined($method_name) + or $self->throw_error('You must define a method name'); + return 1 if $self->{methods}->{$method_name}; my $code = do{ no strict 'refs'; *{$self->{package} . '::' . $method_name}{CODE} };