use Package::Stash to do the subnaming for added methods topic/package_stash_subname
Jesse Luehrs [Mon, 31 May 2010 18:14:34 +0000 (13:14 -0500)]
lib/Class/MOP/Mixin/HasMethods.pm

index e3864a8..5dced15 100644 (file)
@@ -11,7 +11,6 @@ our $AUTHORITY = 'cpan:STEVAN';
 
 use Scalar::Util 'blessed';
 use Carp         'confess';
-use Sub::Name    'subname';
 
 use base 'Class::MOP::Mixin';
 
@@ -83,14 +82,12 @@ sub add_method {
 
     my ( $current_package, $current_name ) = Class::MOP::get_code_info($body);
 
-    if ( !defined $current_name || $current_name =~ /^__ANON__/ ) {
-        my $full_method_name = ( $package_name . '::' . $method_name );
-        subname( $full_method_name => $body );
-    }
-
     $self->add_package_symbol(
         { sigil => '&', type => 'CODE', name => $method_name },
         $body,
+        (!defined($current_name) || $current_name =~ /^__ANON__/)
+            ? (subname => $method_name)
+            : (),
     );
 }