Possible Duplicate:
In Perl, how can I check from which module a given function was imported?
Is it possible to find out the module or file where a specific perl function was defined?
For example, let's say you have a perl script that imports several modules, and one of the modules exports a function named foo() using Exporter's @EXPORT array. How can I programmatically determine the module where foo() was defined?
I tried the following:
use YAML;
sub identify_typeglob {
my $glob = shift;
print 'You gave me ', *{$glob}{PACKAGE}, '::', *{$glob}{NAME}, "\n";
}
identify_typeglob *Dump;
But that just gives me main::Dump
, even though the actual source of the function is YAML::Dump
.