- 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
|| 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)
);
}
|| 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)
);
}
|| 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)
);
}
use strict;
use warnings;
-use Test::More tests => 30;
+use Test::More tests => 28;
use Test::Exception;
use Class::MOP;
'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' );
-}