}
if(ref($code) ne 'CODE'){
- not_supported 'add_method for a method object';
+ $code = \&{$code}; # coerce
}
$self->{methods}->{$name}++; # Moose stores meta object here.
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} };