This is probably due to the method being inherited from a base class. However, in the extremely weird situations, it COULD also be injected into the module's namespace dynamically which is much harder to figure out.
You can find your sub either by brute force searching or by figuring out the base class of a module (and possibly higher up the inheritance chain) and searching just the base classes code. I will show how to do both:
Brute force search: This is probably the easiest solution in complicated cases since the sub could have been injected into the module's namespace dynamically by non-ancestor module and finding ancestor modules is not 100% easy due to multiple ways of defining inheritance that could have been used (use base, use parent, Moose stuff, AUTOLOADED stuff)
First, find out which other modules are loaded with My::Module
perl -e 'use My::Module::DB::raw_info; print "$INC{$_}\n" foreach keys %INC'
This will print the location of ALL those modules
Then, search for the sub definition in ALL that code (the following should be all one line, I split it up for readability into 2 lines):
grep search_like
`perl -e 'use My::Module::DB::raw_info; print "$INC{$_}\n" foreach keys %INC'`
If this returns too many results, change the grep to
grep "sub search_like"
`perl -e 'use My::Module::DB::raw_info; print "$INC{$_}\n" foreach keys %INC'`
This will find you the definition in whichever module My::Module::DB::raw_info inherits from without actually analyzing the module code for inheritance.
Inheritance:
Find out the module's parent using ISA
as follows:
perl -e 'use My::Module::DB::raw_info; print "@My::Module::DB::raw_info::ISA\n";'
To clarify, this only works for "classically inherited" modules using @ISA
, not Moose stuff. It also doesn't work if the routine is called using AutoLoader or is injected into the symbol table dynamically which can happen in any code, not necessarily in the parent one.