in reply to Howto Call Package from a Subdirectory
You could do
use lib 'modules_src'; use MyPackage;
or
BEGIN { require 'modules_src/MyPackage.pm'; # (call import() here, if required...) }
(assuming your current working directory is set such that it contains modules_src; otherwise specify the absolute path)
Though, personally, I prefer to stick to the convention, i.e. if your module is named Sth::MyPackage, then put it in a subdirectory named accordingly: modules_src/Sth/MyPackage.pm. Then, you can write
use lib 'modules_src'; use Sth::MyPackage;
and have your use statement properly indicate the module's namespace...
|
|---|