Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Isn't List::Util part of Standard Perl Distribution?

On a certain system, I am running a perl script and it's failing by saying

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.

Now the strange part is that before deploying the code into the failing system, I ran it on my laptop and it just ran fine. The difference in both the system is, in my laptop I am using Cygwin and perl is bundled with it and the said failing system has 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.

I then searched for Util under the lib of cygwin and it was present under 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

So now I am confused. Isn;t List::Util part of the standard perl distribution? The Reason for my confusion

  1. List/Util.pm is present under i686-cygwin
  2. ActiveSync Installation was not having List/Util.pm
like image 449
Abhijit Avatar asked Nov 30 '22 03:11

Abhijit


2 Answers

List::Util was only added to core in 5.7 (a development version) and the first stable release of perl containing List::Util was 5.8.0. So, while it is in the perl 5.10 distro you have installed under cygwin, the perl 5.6.1 ActiveState executable you called does not have it. You should update the ActiveState perl to at least 5.8.0, and then it will have the module you need.

Here is a link to find all versions of perl that contain a core module: http://perlpunks.de/corelist/version?module=List%3A%3AUtil

like image 126
Dan Avatar answered Dec 06 '22 09:12

Dan


When I check corelist I get:

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

Your perl version seems to be 5.6.1, in which case List::Util would not be part of the core installation.

Judging by the path c:\cygwin\lib\perl5\5.10, it seems your cygwin version is at least 5.10, but as you will note, the cygwin path is not in the @INC of your other perl version. They are most likely separate installations, and therefore they do not share libraries.

Update your ActiveState perl, and all should be well.

like image 44
TLP Avatar answered Dec 06 '22 08:12

TLP