in reply to Re: Changing the name of a function in the call stack
in thread Changing the name of a function in the call stack
use strict; use warnings; use Carp; sub generate { my ( $name ) = @_ ; return sub { local *__ANON__ = $name # M A G I C if $name; carp "***sub called***"; } } sub super { my $not_named = generate(); $not_named->(); my $named = generate('HulaHoop'); $named->(); } super();
-*- mode: compilation; default-directory: "d:/tmp/pm/" -*- Compilation started at Fri Nov 19 21:13:52 C:/Strawberry/perl/bin\perl.exe -w d:/tmp/pm/name_anno_sub.pl ***sub called*** at d:/tmp/pm/name_anno_sub.pl line 12. main::__ANON__() called at d:/tmp/pm/name_anno_sub.pl line 20 main::super() called at d:/tmp/pm/name_anno_sub.pl line 28 ***sub called*** at d:/tmp/pm/name_anno_sub.pl line 12. main::HulaHoop() called at d:/tmp/pm/name_anno_sub.pl line 25 main::super() called at d:/tmp/pm/name_anno_sub.pl line 28 Compilation finished at Fri Nov 19 21:13:53
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Changing the name of a function in the call stack
by kikuchiyo (Hermit) on Nov 19, 2021 at 20:50 UTC | |
by LanX (Saint) on Nov 19, 2021 at 20:56 UTC |