From: Dave Rolsky Date: Tue, 7 Jul 2009 20:46:01 +0000 (-0500) Subject: Revert "give unique names to method modifiers" X-Git-Tag: 0.90~26 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=779ca3d2a597fc9aeecc94548abd6bb153e92048;p=gitmo%2FClass-MOP.git Revert "give unique names to method modifiers" This reverts commit 3a642c024cf3e964eedddffa171cc501bac9265d. --- diff --git a/Changes b/Changes index e23f523..4bba164 100644 --- a/Changes +++ b/Changes @@ -6,10 +6,6 @@ Revision history for Perl extension Class-MOP. - Anonymous classes were not destroyed properly when they went out of scope, leading to a memory leak. RT #47480 (Goro Fuji). - * Class::MOP::Class - - Give method modifiers unique names as they are added so that - introspection of caller() gives you something more useful. - 0.89 Fri Jul 3, 2009 * Class::MOP::Class diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 24234b8..8810338 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -672,7 +672,7 @@ sub add_method { || confess "You must pass in a method name"; my $method = $fetch_and_prepare_method->($self, $method_name); $method->add_before_modifier( - subname(':before-' . $method_name => $method_modifier) + subname(':before' => $method_modifier) ); } @@ -682,7 +682,7 @@ sub add_method { || confess "You must pass in a method name"; my $method = $fetch_and_prepare_method->($self, $method_name); $method->add_after_modifier( - subname(':after-' . $method_name => $method_modifier) + subname(':after' => $method_modifier) ); } @@ -692,7 +692,7 @@ sub add_method { || confess "You must pass in a method name"; my $method = $fetch_and_prepare_method->($self, $method_name); $method->add_around_modifier( - subname(':around-' . $method_name => $method_modifier) + subname(':around' => $method_modifier) ); } diff --git a/t/031_method_modifiers.t b/t/031_method_modifiers.t index 3b04428..4ab736f 100644 --- a/t/031_method_modifiers.t +++ b/t/031_method_modifiers.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 30; +use Test::More tests => 28; use Test::Exception; use Class::MOP; @@ -206,25 +206,3 @@ use Class::MOP::Method; 'check around_modifiers' ); } -# unique names for each modifier -{ - package Foo; - - sub orig1 { - return (caller(1))[3]; - } - - sub orig2 { - return (caller(1))[3]; - } - - my $meta = Class::MOP::Class->initialize(__PACKAGE__); - - $meta->add_around_method_modifier( 'orig1', sub { $_[0]->( $_[1] ) } ); - $meta->add_around_method_modifier( 'orig2', sub { $_[0]->( $_[1] ) } ); -} - -{ - is( Foo->orig1, 'Class::MOP::Class:::around-orig1', 'each modifier gets a unique name' ); - is( Foo->orig2, 'Class::MOP::Class:::around-orig2', 'each modifier gets a unique name' ); -}