Skip to content

Instantly share code, notes, and snippets.

@jhthorsen
Created March 15, 2012 11:37
Show Gist options
  • Save jhthorsen/2043794 to your computer and use it in GitHub Desktop.
Save jhthorsen/2043794 to your computer and use it in GitHub Desktop.
figure out sub name from code ref
my $obj = B::svref_2object($code);
my $name = $obj->GV->NAME;
my $pkg = $obj->GV->STASH->NAME;
warn "The method name is $pkg\::$name";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment