From: Dave Rolsky Date: Mon, 14 Sep 2009 21:29:03 +0000 (-0500) Subject: So apparently the case I thought could never happen _does_ happen. X-Git-Tag: 0.93~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=018cba1d0623503e40de57ccf23fad368935f63f;p=gitmo%2FClass-MOP.git So apparently the case I thought could never happen _does_ happen. This fixes it, but I don't really understand why. --- diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index ec1aedd..441f8c9 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -379,12 +379,11 @@ sub get_method { } ); - # we should never have a blessed map entry but no $code in the package - if ( blessed( $map_entry ) && !$code ) { - my $method = sprintf '%s::%s', $self->name, $method_name; - confess "Found a meta method object in the method map but no" - . " corresponding code entry in the symbol table for $method"; - } + # This seems to happen in some weird cases where methods modifiers are + # 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;