Perl无法在@INC中找到模块

时间:2013-05-24 08:31:36

标签: linux perl redhat

我正在运行Centos 6.4和perl 5.10。我有一个使用DateTime模块的短脚本。但是,当我运行我的脚本时,我收到以下错误消息,告诉我无法找到各种模块,因为它们不在库路径中。

Can't locate Params/Validate.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 /usr/lib64/perl5/DateTime/Duration.pm line 11.
BEGIN failed--compilation aborted at /usr/lib64/perl5/DateTime/Duration.pm line 11.
Compilation failed in require at /usr/lib64/perl5/DateTime.pm line 45.
BEGIN failed--compilation aborted at /usr/lib64/perl5/DateTime.pm line 45.
Compilation failed in require at ./jr_fix_western_filestore.perl line 39.
BEGIN failed--compilation aborted at ./jr_fix_western_filestore.perl line 39.

所有这些包都是通过yum安装的。例如yum install perl-Params-Validate.x86_64yum install perl-DateTime.x86_64。 yum安装不应该将这些模块放在@INC中吗?

我还尝试通过cpan安装软件包,但这似乎首先想要下载大量的依赖项,并且不可避免地会失败。

  CPAN.pm: Going to build D/DR/DROLSKY/DateTime-1.03.tar.gz

Can't locate Module/Build.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 Build.PL line 5.
BEGIN failed--compilation aborted at Build.PL line 5.
Warning: No success on command[/usr/bin/perl Build.PL --installdirs site]
Warning (usually harmless): 'YAML' not installed, will not store persistent state
  DROLSKY/DateTime-1.03.tar.gz
  /usr/bin/perl Build.PL --installdirs site -- NOT OK
Running Build test
  Make had some problems, won't test
Running Build install
  Make had some problems, won't install
Could not read '/root/.cpan/build/DateTime-1.03-Brpqo5/META.yml'. Falling back to other methods to determine prerequisites
  Warning: CPAN.pm discovered Module::Build as undeclared prerequisite.
  Adding it now as such.

当我尝试在cpan中安装Module :: Build时,出现以下错误

Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible
Failed during this command:
 OVID/Test-Harness-3.28.tar.gz                : make_test NO
 MSCHWERN/Test-Simple-0.98.tar.gz             : make_test NO
 JPEACOCK/version-0.9902.tar.gz               : make_test NO
 BOBTFISH/Module-Metadata-1.000014.tar.gz     : make_test NO
 DAGOLDEN/CPAN-Meta-YAML-0.008.tar.gz         : make_test NO
 MAKAMAKA/JSON-PP-2.27202.tar.gz              : make_test NO
 DAGOLDEN/Parse-CPAN-Meta-1.4404.tar.gz       : make_test NO
 DAGOLDEN/CPAN-Meta-Requirements-2.122.tar.gz : make_test NO
 DAGOLDEN/CPAN-Meta-2.130880.tar.gz           : make_test NO
 DAGOLDEN/Perl-OSType-1.003.tar.gz            : make_test NO
 JESSE/Locale-Maketext-Simple-0.21.tar.gz     : make_test NO
 BINGOS/Params-Check-0.36.tar.gz              : make_test NO
 BINGOS/Module-Load-0.24.tar.gz               : make_test NO
 BINGOS/Module-CoreList-2.91.tar.gz           : make_test NO
 BINGOS/Module-Load-Conditional-0.54.tar.gz   : make_test NO
 BINGOS/IPC-Cmd-0.80.tar.gz                   : make_test NO
 DAGOLDEN/ExtUtils-CBuilder-0.280205.tar.gz   : make_test NO
 LEONT/Module-Build-0.4005.tar.gz             : make NO

任何指针?


rpm -ql perl-Params-Validate返回

/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Attribute
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Attribute/Params
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Attribute/Params/Validate.pm
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Params
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Params/Validate.pm
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Params/ValidatePP.pm
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Params/ValidateXS.pm
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/auto/Params
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/auto/Params/Validate
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/auto/Params/Validate/Validate.bs
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/auto/Params/Validate/Validate.so
/usr/share/doc/perl-Params-Validate-0.95
/usr/share/doc/perl-Params-Validate-0.95/Changes
/usr/share/doc/perl-Params-Validate-0.95/LICENSE
/usr/share/doc/perl-Params-Validate-0.95/MANIFEST
/usr/share/doc/perl-Params-Validate-0.95/META.yml
/usr/share/doc/perl-Params-Validate-0.95/README
/usr/share/doc/perl-Params-Validate-0.95/TODO
/usr/share/man/man3/Attribute::Params::Validate.3pm.gz
/usr/share/man/man3/Params::Validate.3pm.gz
/usr/share/man/man3/Params::ValidatePP.3pm.gz
/usr/share/man/man3/Params::ValidateXS.3pm.gz

我不确定这些路径是否被@INC

搜索

locate Validate.pm不返回任何内容

3 个答案:

答案 0 :(得分:4)

搜索并安装

 yum install perl-CGI

这对我有用。

答案 1 :(得分:2)

似乎您为RHEL / Centos 4配置了RPMforge,但您使用的是Centos 6:

  

安装:perl-Params-Validate x86_64 0.95-1。 el4 .rf

按照this site的说明进行全局dist升级以修复损坏的依赖项(我很幸运,重新安装不需要)。然后安装所需的perl包。

答案 2 :(得分:0)

我迟到了讨论,但遇到了同样的问题。以下是我解决它的方法。

CPAN给了我同样的错误,因为在yum下安装了旧版本。我通过yum更新了包,并且能够继续前进。