I have one .pm and .pl file in the same location. When i execute the file, it works fine. When i keep .pm and .pl file in different location, I get this error. How to handle this, pls share your input. Appreciate your help!
[sjothili@localhost script]$ perl fapatch-prereq.pl Can't locate Fapatching.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at fapatch-prereq.pl line 3.
[sjothili@localhost Apr3]$ pwd
/scratch/sjothili/perl/Apr3
enter code here
cat Fapatching.pm
#!/usr/bin/perl
package Fapatching;
sub doSystemCommand
{
$systemCommand = $_[0];
print LOG "$0: Executing [$systemCommand] \n";
$returnCode = system( $systemCommand );
if ( $returnCode != 0 )
{
die "Failed executing [$systemCommand]\n";
exit 0;
}
}
1;
cat fapatch-prereq.pl
#!/usr/bin/perl
require Fapatching;
Fapatching::doSystemCommand("pwd");
[sjothili@localhost Apr3]$ perl fapatch-prereq.pl /scratch/sjothili/perl/Apr3
[sjothili@localhost script]$ cd ..
[sjothili@localhost Apr3]$ pwd
/scratch/sjothili/perl/Apr3
[sjothili@localhost Apr3]$ cd script/
[sjothili@localhost script]$ ls
fapatch-prereq.pl
`enter code here`[sjothili@localhost script]$ perl fapatch-prereq.pl
Can't locate Fapatching.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at fapatch-prereq.pl line 3.
lib
folder? – ssr1012