From: Jesse Luehrs Date: Mon, 31 May 2010 18:14:34 +0000 (-0500) Subject: use Package::Stash to do the subnaming for added methods X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=622c8ef2d9e9c107448b09a127a8263742db886e;p=gitmo%2FClass-MOP.git use Package::Stash to do the subnaming for added methods --- diff --git a/lib/Class/MOP/Mixin/HasMethods.pm b/lib/Class/MOP/Mixin/HasMethods.pm index e3864a8..5dced15 100644 --- a/lib/Class/MOP/Mixin/HasMethods.pm +++ b/lib/Class/MOP/Mixin/HasMethods.pm @@ -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) + : (), ); }