But personally I would use Sub::Identify.use B; sub codename { my $coderef = shift; return unless ref $coderef eq 'CODE'; my $cv = B::svref_2object($coderef); return $cv->GV->NAME; }
use Sub::Identify qw(sub_name); sub foo {} print sub_name(\&foo);
In reply to Re: Find the name of a CODEref
by imp
in thread Find the name of a CODEref
by Dylan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |