in reply to Howto Call Package from a Subdirectory
The overall code directory structure look simply like this:Since the package you want to load is identifiying itself as Sth::MyPackage, you must put the file MyPackage.pm into a directory named Sth and include the parent directory of Sth in @INC.
From the docs (perldoc -f require):
In other words, if you try this:require Foo::Bar; # a splendid barewordThe require function will actually look for the "Foo/Bar.pm" file in the directories specified in the @INC array.
And use is "an enhanced version of require", so to speak. See perlfaq8 for differences between do, require and use.
You can add the parent of Sth (say, ~/MyPerl/modules_src) with
use lib '/home/neversaint/MyPerl/modules_src'; # no tilde expansion
or including that path in your PERL5LIB environment variable.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|