We have a Perl framework in which we have created some customized module. Whenever I am trying to use the modules inside a sub-directory it throw Error.
Below is my Folder structure, frameworkfolder
being the base/root directory of the project:
.../frameworkfolder/PerlModules/Initialize.pm
I need to use this Initialize.pm
in a Perl file which is in another directory
.../frameworkfolder/TestCases/FVT/fvt/fvt.pl
In fvt.pl
, when I use PerlModules::Initialize
, it throws the following error:
Can't locate PerlModules/Initialize.pm in @INC (you may need to install the PerlModules::Initialize module) (@INC contains: /usr/opt/perl5/lib/site_perl/5.28.1/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.28.1 /usr/opt/perl5/lib/5.28.1/aix-thread-multi /usr/opt/perl5/lib/5.28.1)
How do I use the Initialize.pm
Perl package from fvt.pl
? or any other perl files inside any other directory?
I have tried below solutions but no luck:
use lib '../../../frameworkfolder';
and
use FindBin;
use lib "$FindBin::Bin"
and
use FindBin;
use File::Spec;
use lib File::Spec->catdir($FindBin::Bin, '../../', 'lib');
and
#!/usr/local/bin/perl -w -I /frameworkfolder/
Did not find answer in : How is Perl's @INC constructed? (aka What are all the ways of affecting where Perl modules are searched for?)