Reverse lookup the name of a code-ref
Found on perlmonks here: http://www.perlmonks.org/?node_id=413799
The code:
use B; sub coderef2name { eval { my $obj = B::svref_2object( shift() ); $obj->GV->STASH->NAME . "::" . $obj->GV->NAME; } || undef; }
This is a static archival copy of my old wiki.
My current blog is here: https://blog.bjdean.id.au/
Found on perlmonks here: http://www.perlmonks.org/?node_id=413799
The code:
use B; sub coderef2name { eval { my $obj = B::svref_2object( shift() ); $obj->GV->STASH->NAME . "::" . $obj->GV->NAME; } || undef; }
BradsWiki: Programming Notes/PerlProgramming/ReverseLookupTheNameOfACoderef (last edited 2012-04-16 13:38:31 by BradleyDean)