Remove subname() in add_method(). Now add_package_symbol() does it in a smart way.
gfx [Mon, 17 Aug 2009 04:34:48 +0000 (13:34 +0900)]
lib/Class/MOP/Module.pm
lib/Class/MOP/Package.pm

index e7ce4d1..ae89002 100644 (file)
@@ -61,8 +61,8 @@ sub _instantiate_module {
     Class::MOP::_is_valid_class_name($package_name)
         || confess "creation of $package_name failed: invalid package name";
 
-    $self->add_package_symbol('$VERSION',   \$version);
-    $self->add_package_symbol('$AUTHORITY', \$authority);
+    ${ $self->get_package_symbol('$VERSION',   create => 1) } = $version;
+    ${ $self->get_package_symbol('$AUTHORITY', create => 1) } = $authority;
 
     return;
 }
index f2c8e44..c69ab02 100644 (file)
@@ -256,14 +256,6 @@ sub add_method {
         $body = $method;
     }
 
-
-    my ( $current_package, $current_name ) = Class::MOP::get_code_info($body);
-
-    if ( !defined $current_name || $current_name eq '__ANON__' ) {
-        my $full_method_name = ($self->name . '::' . $method_name);
-        subname($full_method_name => $body);
-    }
-
     $self->add_package_symbol(
         { sigil => '&', type => 'CODE', name => $method_name },
         $body,