在某个系统上,我正在运行一个 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 的库下搜索了 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
所以现在我很困惑。不是;t List::Util 标准 perl 发行版的一部分吗?
我困惑的原因
最佳答案
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
关于perl - List::Util 不是标准 Perl 发行版的一部分吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8694638/