What problem are you trying to solve by knowing this? There might be a way to fix that before it happens. :)
–
brian d foySep 10 '10 at 17:10

Modifying functions from other classes may be common in Ruby, but is a black art in Perl that should be reserved for extremely rare situations. Why do you need to do this?
–
EtherSep 13 '10 at 16:24

@'brian d foy' Three years later I'm trying to write a unit test to confirm that I correctly get a pure-Perl version of a function under one condition, or an XS version under other another condition, and suddenly I have what I feel is a legitimate use-case for this OP's quesiton. ;)
–
DavidOSep 3 '13 at 21:26

3 Answers
3

The Devel::Peek module is very handy to get all sorts of information about variables. One of the things you can do with it is dump a reference to a subroutine and get the name of the glob it came from:

An alternative solution would be Sub::Identify, which really only gives you names for code references you hand to it. However, knowing about Devel::Peek is handy in many other situations too, so I mentioned that first.