是不是List :: Util是Standard Perl Distribution的一部分?

时间:2012-01-01 18:14:00

标签: perl list cygwin activestate

在某个系统上,我正在运行一个perl脚本,并且它失败了,说

Can't locate List/Util.pm in @INC (@INC contains: <Some-Path>/ActiveState/perl/lib <Some-Path>/ActiveState/perl/site/lib .) at <Some-Other-Path>\searchCobolPgms.ps line 7.

现在奇怪的是,在将代码部署到故障系统之前,我在笔记本电脑上运行它并且运行正常。系统的不同之处在于,在我的笔记本电脑中,我使用的是Cygwin,并且perl与它捆绑在一起,并且所述失败的系统有ActiveState perl

<Some-Path>perl -v

This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2001, Larry Wall

Binary build 635 provided by ActiveState Corp. http://www.ActiveState.com
Built 15:34:21 Feb  4 2003


Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

然后我在cygwin的lib下搜索了Util,它出现在i686-cygwin下

c:\cygwin\lib\perl5\5.10>find . -name Util.pm
./CGI/Util.pm
./i686-cygwin/Hash/Util.pm
./i686-cygwin/List/Util.pm
./i686-cygwin/Scalar/Util.pm

所以现在我很困惑。不是List :: Util标准perl发行版的一部分吗? 我混淆的原因

  1. List / Util.pm出现在i686-cygwin
  2. ActiveSync安装没有List / Util.pm

2 个答案:

答案 0 :(得分:12)

List :: Util仅添加到5.7(开发版本)中的核心,并且包含List :: Util的perl的第一个稳定版本是5.8.0。因此,虽然它是在你安装在cygwin下的perl 5.10发行版中,但是你调用的perl 5.6.1 ActiveState可执行文件没有它。您应该将ActiveState perl更新为至少5.8.0,然后它将具有您需要的模块。

这是一个链接,用于查找包含核心模块的所有perl版本:http://perlpunks.de/corelist/version?module=List%3A%3AUtil

答案 1 :(得分:10)

当我检查corelist时,我得到了:

corelist List::Util
List::Util was first released with perl v5.7.3

您的perl版本似乎是5.6.1,在这种情况下List::Util不会成为核心安装的一部分。

根据路径c:\cygwin\lib\perl5\5.10判断,您的cygwin版本似乎至少为5.10,但正如您将注意到的,cygwin路径不在您的其他perl版本的@INC中。它们很可能是单独的安装,因此它们不共享库。

更新你的ActiveState perl,一切都应该没问题。