Revert "Remove subname() in add_method(). Now add_package_symbol() does it in a smart...
gfx [Wed, 19 Aug 2009 09:11:33 +0000 (18:11 +0900)]
This reverts commit d6d832874639934e7faa18e6ecb70a2a821c3b21.

Conflicts:

lib/Class/MOP/Module.pm

lib/Class/MOP/Package.pm

index 47767c5..92463aa 100644 (file)
@@ -330,6 +330,14 @@ 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,