in reply to Getting the name of the subroutine called. There is a way for a clone references?!

If you're not interested in performance, but just want to log when which subroutine is called, then you can steal both code references and replace them with a routine of your own. Something like this:
{ # start a scope here to prevent interference with anything else my $test = \&main::test1; # only need this once as they are the same *main::test1 = sub { print "<main::test1> @_\n"; goto &$test }; *main::test2 = sub { print "<main::test2> @_\n"; goto &$test }; } # $test kept because still refs in the anonymous subs

Hope this helps.

Liz

  • Comment on Re: Getting the name of the subroutine called. There is a way for a clone references?!
  • Download Code