I have a perl file that uses a sub routine (a function) defined in a different module inside the same directory. However, that module is never required in the original file, nor is the subroutine defined anywhere in the file, nor is it called from the module properly.
From my understanding, a subroutine from a module is called like such
require "module1.pm";
Module1::greet();
However, the file im working with simply goes
greet()
How is this possible? Is it something to do with "import"? The file im working in is likely a module for a main file somewhere else that requires all the modules, does it work like that? If the subroutine's module is never specified, how do I track it down other than the comb through all the other modules in the directory? I didn't write the code i'm working with, so I'm not familiar with the structure.
There are many ways to provide functions to other code, and by the design of the whole system, which is quite flexible and fluid, some of them are quite devilous. (It is up to the developer's good practice and taste to choose.)
Consider this bad manner
main.pl
In the same directory,
Mod1.pmand
Mod2.pmWhen you run
perl main.plit printsSo yes, it is possible to push function names into programs even as they don't ask for nor know about it.
If you can provide more detail it may be possible to come up with a reasonable way to work with what you've got, but it is also possible that you may have to account for who calls who from where (etc) by going through files.