From: gfx Date: Wed, 15 Jul 2009 23:56:07 +0000 (+0900) Subject: Remove unnecessary calls of has_method() X-Git-Tag: 0.90~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=221f9302d6fe26d935a292c36ab0124b4a47efbc;p=gitmo%2FClass-MOP.git Remove unnecessary calls of has_method() has_method() is simply "defined get_method(...)". --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index d01da0f..bbb3158 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -799,10 +799,8 @@ sub find_method_by_name { (defined $method_name && $method_name) || confess "You must define a method name to find"; foreach my $class ($self->linearized_isa) { - # fetch the meta-class ... - my $meta = $self->initialize($class); - return $meta->get_method($method_name) - if $meta->has_method($method_name); + my $method = $self->initialize($class)->get_method($method_name); + return $method if defined $method; } return; } @@ -856,10 +854,8 @@ sub find_next_method_by_name { my @cpl = $self->linearized_isa; shift @cpl; # discard ourselves foreach my $class (@cpl) { - # fetch the meta-class ... - my $meta = $self->initialize($class); - return $meta->get_method($method_name) - if $meta->has_method($method_name); + my $method = $self->initialize($class)->get_method($method_name); + return $method if defined $method; } return; }