move the package_cache stuff back into ::HasMethods
[gitmo/Class-MOP.git] / lib / Class / MOP / Mixin / HasMethods.pm
index 3d6f82c..d3ceaa8 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use Class::MOP::Method::Meta;
 
-our $VERSION   = '1.10';
+our $VERSION   = '1.11';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -36,12 +36,6 @@ sub _add_meta_method {
     );
 }
 
-# This doesn't always get initialized in a constructor because there is a
-# weird object construction path for subclasses of Class::MOP::Class. At one
-# point, this always got initialized by calling into the XS code first, but
-# that is no longer guaranteed to happen.
-sub _method_map { $_[0]->{'methods'} ||= {} }
-
 sub wrap_method_body {
     my ( $self, %args ) = @_;
 
@@ -162,7 +156,7 @@ sub remove_method {
     ( defined $method_name && length $method_name )
         || confess "You must define a method name";
 
-    my $removed_method = delete $self->_full_method_map->{$method_name};
+    my $removed_method = delete $self->_method_map->{$method_name};
 
     $self->remove_package_symbol(
         { sigil => '&', type => 'CODE', name => $method_name } );
@@ -219,6 +213,18 @@ sub _restore_metamethods_from {
     }
 }
 
+sub reset_package_cache_flag  { (shift)->{'_package_cache_flag'} = undef }
+sub update_package_cache_flag {
+    my $self = shift;
+    # NOTE:
+    # we can manually update the cache number
+    # since we are actually adding the method
+    # to our cache as well. This avoids us
+    # having to regenerate the method_map.
+    # - SL
+    $self->{'_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);
+}
+
 1;
 
 __END__