bump version to 0.94
[gitmo/Class-MOP.git] / lib / Class / MOP / Package.pm
index fd745db..f6d4261 100644 (file)
@@ -8,7 +8,7 @@ use Scalar::Util 'blessed', 'reftype';
 use Carp         'confess';
 use Sub::Name    'subname';
 
-our $VERSION   = '0.92_01';
+our $VERSION   = '0.94';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -331,7 +331,7 @@ sub add_method {
         # The method object won't be created until required.
         $body = $method;
     }
-    Carp::cluck('wtf') unless defined $self->_method_map;
+
     $self->_method_map->{$method_name} = $method;
 
     my ( $current_package, $current_name ) = Class::MOP::get_code_info($body);
@@ -379,10 +379,13 @@ sub get_method {
         }
     );
 
-    return $map_entry if blessed $map_entry && $map_entry->body == $code;
+    # 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;
 
-    # we should never have a blessed map entry but no $code in the package
-    die 'WTF' if blessed $map_entry && ! $code;
+    return $map_entry if blessed $map_entry && $map_entry->body == $code;
 
     unless ($map_entry) {
         return unless $code && $self->_code_is_mine($code);