http://www.perlmonks.org?node_id=11138880

Lewis has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm very beginner of Perl, I have some problem about module loading(?)

I'm running simulation with some script file. This script contains line "package That::Module" to use the subroutine of a package in a module.(blessed subroutine) However, that module is located in the root directory "other/root/directory/Module.pm" different from my simulation directory "My/Directory/Simulation/script".

I think this is possible because @INC already has a path to find the module. (I checked with perl -V, but fail to find exact module path. but script runs successfully anyway) script can run succesfully without line "package That::Module" too. I think it's because the path is environmentally defined and there is no subroutine with the same name in @INC.

For the test, I created another directory and put same script file like this.

My/test/Directory/script2 (same code except "That::Module" -> "This::Module". Intentionally changed to prevent conflicts with existing module "That::Module".) And module file My/test/Directory/This/Module.pm

But for the successful execution, I had to add line "use This::Module" in script2 before(or after) line "package This::Module". I tried both <perl option: perl -I My/test/Directory/This script2> and <use lib '/My/.../This';>line in script2. but still need "use This::Module" line.

I want to know how my simulation script runs successfully without the phrase "use". (Is it defined in a location I don't know?) And want to know how to add(or load? or install? I have some confusion about this.) module and run script2 without the phrase "use" in my test directory.