11 sub bar { ( caller(0) )[3] }
16 my $Foo = Class::MOP::Class->initialize('Foo');
18 $Foo->add_method( foo => sub { ( caller(0) )[3] } );
21 [ Class::MOP::get_code_info( $Foo->get_method('foo')->body ) ],
23 "subname applied to anonymous method",
26 is( Foo->foo, "Foo::foo", "caller() aggrees" );
28 $Foo->add_method( bar => \&Origin::bar );
30 is( Origin->bar, "Origin::bar", "normal caller() operation in unrelated class" );
33 [ Class::MOP::get_code_info( $Foo->get_method('foo')->body ) ],
35 "subname not applied if a name already exists",
38 is( Foo->bar, "Origin::bar", "caller aggrees" );
40 is( Origin->bar, "Origin::bar", "unrelated class untouched" );