Boo!! DProf still plops everything into main::__ANON__. I've run into this problem before trying to profile code that uses liberal amounts of anonymous subs, and it's quite annoying. Unfortunately I don't know enough about the internals of Perl and DProf to figure out a "clever" solution like yours that works for profiling code (other than using other *Prof modules)...use Carp; my $i = 0; sub foo { sub { local *__ANON__ = "local_subref_" . $i++; carp "blokhead"; }; } foo()->() for 1 .. 3; __OUTPUT__ $ perl -d:DProf test.pl blokhead at test.pl line 7 main::local_subref_0() called at test.pl line 12 blokhead at test.pl line 7 main::local_subref_1() called at test.pl line 12 blokhead at test.pl line 7 main::local_subref_2() called at test.pl line 12 blokhead at test.pl line 7 main::local_subref_3() called at test.pl line 12 $ dprofpp tmon.out Total Elapsed Time = 0.079705 Seconds User+System Time = 0.049705 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name ... 0.00 - 0.020 3 - 0.0066 main::__ANON__ ...
blokhead
In reply to Re: Named anonymous subs
by blokhead
in thread Named anonymous subs
by ysth
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |