From: Dave Rolsky Date: Mon, 14 Sep 2009 20:42:03 +0000 (-0500) Subject: Ok, the error that can never happened, so it should give a useful error message X-Git-Tag: 0.93~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8885b9243cf5f2df4c65bc33aa5d618540329927;p=gitmo%2FClass-MOP.git Ok, the error that can never happened, so it should give a useful error message --- diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index 7589e2e..ec1aedd 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -379,10 +379,14 @@ sub get_method { } ); - return $map_entry if blessed $map_entry && $map_entry->body == $code; - # we should never have a blessed map entry but no $code in the package - die 'WTF' if blessed $map_entry && ! $code; + 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"; + } + + return $map_entry if blessed $map_entry && $map_entry->body == $code; unless ($map_entry) { return unless $code && $self->_code_is_mine($code);