在@INC中找不到脚本/Config.pm(您可能需要安装scripts :: Config模块)

时间:2019-01-04 08:34:46

标签: perl

Can't locate scripts/Config.pm in @INC
(you may need to install the scripts::Config module)
(@INC contains:
    /etc/perl
    /usr/local/lib/x86_64-linux-gnu/perl/5.24.1
    /usr/local/share/perl/5.24.1
    /usr/lib/x86_64-linux-gnu/perl5/5.24
    /usr/share/perl5
    /usr/lib/x86_64-linux-gnu/perl/5.24
    /usr/share/perl/5.24
    /usr/local/lib/site_perl
    /usr/lib/x86_64-linux-gnu/perl-base
) at scripts/Training.pl line 54.

(添加了换行符以提高可读性)

我尝试使用cpan install scripts :: Config安装模块,但是它不起作用。

Loading internal null logger. Install Log::Log4perl for logging messages
Reading '/home/japangly/.cpan/Metadata'
  Database was generated on Thu, 03 Jan 2019 13:29:03 GMT
Warning: Cannot install scripts::Config, don't know what it is.
Try the command
    i /scripts::Config/
to find objects with matching identifiers.

我试图在/ usr / local中创建链接,但是它是空的:

ln -s /usr/{,local/}lib/perl5/5.8.3

ln -s /usr/{,local/}lib/perl5/site_perl/5.8.3

https://www.perlmonks.org/?node_id=746288

我使用谷歌云平台:

$其中$ /usr/bin/perl

$ perl -e“ print join(\” \ n \“,@INC);”

/etc/perl
/usr/local/lib/x86_64-linux-gnu/perl/5.24.1
/usr/local/share/perl/5.24.1
/usr/lib/x86_64-linux-gnu/perl5/5.24
/usr/share/perl5
/usr/lib/x86_64-linux-gnu/perl/5.24
/usr/share/perl/5.24
/usr/local/lib/site_perl
/usr/lib/x86_64-linux-gnu/perl-base

1 个答案:

答案 0 :(得分:3)

错误消息是:

  

无法在scripts / Training.pl第54行找到scripts / Config.pm ...

第53和54行看起来像

#line 53
$| = 1; if ( @ARGV < 1 ) { print "usage: Training.pl Config.pm\n"; exit(0); } # load configuration variables
require( $ARGV[0] );

该脚本期望从文件Config.pm所在的目录中运行。也许您也可以将其作为perl scripts/Training.pl scripts/Config.pm运行或将Config.pm放入当前目录,而不是将其放在scripts/中。

您可能希望通过向.添加以下行来向模块搜索路径添加scripts/Training.pl,以便在将Perl从5.24升级到较新版本时对它进行将来验证:

use lib '.';