in reply to possible to determine the name of a sub from a sub reference?
Maybe CvGV from Devel::Peek?
DB<5> x "" . Devel::Peek::CvGV( \&foo ) 0 '*main::foo'
Also, it's not necessary to resort to eval to generate a coderef from a sub name. Presuming you're trying to get around strict, just temporarily disable it for a small block.
my $coderef = do { no strict 'refs'; \&{ $subname } };
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: possible to determine the name of a sub from a sub reference?
by taghi (Initiate) on Oct 07, 2008 at 19:14 UTC |