From: Dave Rolsky Date: Thu, 5 Aug 2010 23:05:32 +0000 (+0200) Subject: A small optimization to CMOP::Mixin::HasMethods::get_method (from profiling) X-Git-Tag: 1.05~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6038ad58fc973409650490c9dcc0c4302a084044;hp=d765b92d62f0992a41d37a17c60f8af3f8c17525;p=gitmo%2FClass-MOP.git A small optimization to CMOP::Mixin::HasMethods::get_method (from profiling) --- diff --git a/lib/Class/MOP/Mixin/HasMethods.pm b/lib/Class/MOP/Mixin/HasMethods.pm index 3cf042d..34a66b4 100644 --- a/lib/Class/MOP/Mixin/HasMethods.pm +++ b/lib/Class/MOP/Mixin/HasMethods.pm @@ -110,9 +110,8 @@ sub get_method { # added via roles or some other such bizareness. Honestly, I don't totally # understand this, but returning the entry works, and keeps various MX # modules from blowing up. - DR - return $map_entry if blessed $map_entry && !$code; - - return $map_entry if blessed $map_entry && $map_entry->body == $code; + return $map_entry + if blessed $map_entry && ( !$code || $map_entry->body == $code ); unless ($map_entry) { return unless $code && $self->_code_is_mine($code);