sub name { { package For_name_internal_use; use overload '""' => sub { $_[0]->() }, fallback => 1; } return bless sub { my $in_copy; for (my $stack = 2; ! $in_copy and my @caller = caller +($stack); ++$stack) { $in_copy = 1 if $caller[3] && $caller[3] eq 'w +hatever::copy'; } if ($in_copy) { return 'some result to be used in whatever::co +py'; } else { return 'some result to be used outside of what +ever::copy'; } }, 'For_name_internal_use'; }
In reply to Re: finding the method name 2 levels above
by ysth
in thread finding the method name 2 levels above
by introx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |