From: Florian Ragwitz Date: Wed, 18 Nov 2009 20:58:38 +0000 (+0100) Subject: Stop add_method from behaving differently under the debugger. X-Git-Tag: 0.95~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0f96709cb3d0714b80ca927f84f56199e1f30d1a;p=gitmo%2FClass-MOP.git Stop add_method from behaving differently under the debugger. Under -d, the subname of an anon coderef is '__ANON__[Some/File.pm:42]' instead of just '__ANON__'. --- diff --git a/Changes b/Changes index df7830f..b59ca5a 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,10 @@ Revision history for Perl extension Class-MOP. - Make is_class_loaded without any arguments fail loudly (Florian Ragwitz). + * Class::MOP::Package + - Stop add_method from behaving differently under the debugger + (Florian Ragwitz). + * Class::MOP::Class * Class::MOP::Package - Any method which takes a method name as an argument now allows names diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index 5ad509a..9fd9f43 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -320,7 +320,7 @@ sub add_method { if ($method->package_name ne $self->name) { $method = $method->clone( package_name => $self->name, - name => $method_name + name => $method_name, ) if $method->can('clone'); } @@ -336,7 +336,7 @@ sub add_method { my ( $current_package, $current_name ) = Class::MOP::get_code_info($body); - if ( !defined $current_name || $current_name eq '__ANON__' ) { + if ( !defined $current_name || $current_name =~ /^__ANON__/ ) { my $full_method_name = ($self->name . '::' . $method_name); subname($full_method_name => $body); }