Remove method object generation stuff, which is no longer required
gfx [Sun, 12 Jul 2009 03:54:02 +0000 (12:54 +0900)]
lib/Class/MOP/Class.pm
lib/Class/MOP/Method.pm

index f5ca01a..0530739 100644 (file)
@@ -742,26 +742,24 @@ sub get_method {
 
     my $method_map    = $self->_method_map;
     my $method_object = $method_map->{$method_name};
+    my $code = $self->get_package_symbol({
+        name  => $method_name,
+        sigil => '&',
+        type  => 'CODE',
+    });
 
-    if(!($method_object && $method_object->_is_valid_generation)){
-        my $code = $self->get_package_symbol({
-            name  => $method_name,
-            sigil => '&',
-            type  => 'CODE',
-        });
-
-        if(!($code && $self->_code_is_mine($code))){
-            delete $method_map->{$method_name};
-            return undef;
-        }
-        if(!($method_object && $method_object->body == $code)){
+    if (!($method_object && $method_object->body == ($code || 0))){
+        if ($code && $self->_code_is_mine($code)) {
            $method_object = $method_map->{$method_name} = $self->wrap_method_body(
                body                 => $code,
                name                 => $method_name,
                associated_metaclass => $self,
            );
-       }
-       $method_object->_update_generation();
+        }
+        else {
+            delete $method_map->{$method_name};
+            return undef;
+        }
     }
 
     return $method_object;
index c6e7afc..ea580ab 100644 (file)
@@ -57,25 +57,6 @@ sub _new {
 
 sub associated_metaclass { shift->{'associated_metaclass'} }
 
-sub _is_valid_generation{
-    my($self) = @_;
-    my $metaclass = $self->associated_metaclass;
-
-    if($metaclass){
-        return( ($self->{_generation} || 0) == Class::MOP::check_package_cache_flag($metaclass->name) );
-    }
-    else{
-        return 1;
-    }
-}
-
-sub _update_generation {
-    my($self) = @_;
-    my $metaclass = $self->associated_metaclass
-        or confess("No metaclass associated to the method " . $self->name);
-    $self->{_generation} = Class::MOP::check_package_cache_flag($metaclass->name);
-}
-
 sub attach_to_class {
     my ( $self, $class ) = @_;
     $self->{associated_metaclass} = $class;