perl - how Sub::Name set anonymous subroutine 's caller to NOT __ANON__? -


i reading programming perl, @ chapter 12, objects, has following documents :

the next::method has similar problems because uses package of caller figure out class at. if define method in donkey package, next::method break:

package main; *donkey::sound = sub { (shift)–>next::method(@_) }; 

the anonymous subroutine shows in stack _ anon _, next::method doesn’t know package in. can use sub::name cpan module make work out, though:

use sub::name qw(subname); *donkey::sound = subname 'donkey::sound' => sub { (shift)–>next::method(@_) }; 

i inquisitive how sub::name module complete work ? let anonymous subroutine's caller not __anon__

very :)


Comments