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;
}

BradsWiki: Programming Notes/PerlProgramming/ReverseLookupTheNameOfACoderef (last edited 2012-04-16 13:38:31 by BradleyDean)