Possible duplicate:
In Perl, how can I check from which module this function was imported?
Is it possible to find out a module or file where a specific perl function is defined?
For example, let's say you have a perl script that imports several modules, and one of the modules exports a function called foo () using the Exporter @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 it just gives me main::Dump, although the actual source of the function YAML::Dump.
source
share