【发布时间】:2020-07-15 08:23:49
【问题描述】:
我在同一位置有一个 .pm 和 .pl 文件。当我执行文件时,它工作正常。 当我将 .pm 和 .pl 文件保存在不同的位置时,出现此错误。如何处理这个,请分享您的意见。 感谢您的帮助!
[sjothili@localhost 脚本]$ perl fapatch-prereq.pl 在@INC 中找不到 Fapatching.pm(@INC 包含:/usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/ lib64/perl5 /usr/share/perl5 .) 在 fapatch-prereq.pl 第 3 行。
[sjothili@localhost Apr3]$ pwd
/scratch/sjothili/perl/Apr3
enter code herecat 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文件夹中?
标签: perl