Not reliably. Here's code that breaks dws' example. I've never had the need for the feature you describe, however. (I could also walk the symbol tables until I found the right CV, but that's even worse. :)
my $sub; BEGIN { $sub = sub { my ($called) = (caller(0))[3]; warn "Called as <$called>\n"; }; *{ bar } = $sub; } my $b = \&bar; $sub->(); *{ foo } = $sub; foo(); bar(); $b->(); *{ baz } = $b; baz();
In reply to Re: Subroutine names internally
by chromatic
in thread [untitled node, ID 193989]
by Samn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |