From: Fuji, Goro Date: Mon, 27 Sep 2010 02:24:08 +0000 (+0900) Subject: Add an error check X-Git-Tag: 0.75~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=793458491cfc640b71f04684e2644c7ceeac648e;p=gitmo%2FMouse.git Add an error check --- diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index 622f142..51c7d76 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -154,7 +154,7 @@ sub _collect_roles { } -sub find_method_by_name{ +sub find_method_by_name { my($self, $method_name) = @_; defined($method_name) or $self->throw_error('You must define a method name to find'); @@ -181,6 +181,8 @@ sub get_all_method_names { sub find_attribute_by_name { my($self, $name) = @_; + defined($name) + or $self->throw_error('You must define an attribute name to find'); foreach my $attr($self->get_all_attributes) { return $attr if $attr->name eq $name; }