Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: System vs. User module version of List::Util

by kcott (Archbishop)
on Jun 18, 2017 at 05:50 UTC ( [id://1193034]=note: print w/replies, xml ) Need Help??


in reply to System vs. User module version of List::Util

G'day Lady Aleena,

What you have installed locally ("from the command line") indicates Perl 5.24.1; however, whatever your ISP, or equivalent, has installed ("from the browser") indicates Perl 5.8.8.

As far as I know, the core List::Util module has never had the uniq function. Here's the online perldoc for the nearest versions I could find: List::Util (Perl 5.8.8 core) and List::Util (Perl 5.24.0 core) — note the absence of the uniq function in both of those.

When you install List::Util from CPAN, you're actually getting a bundle of modules. At the top of List::Util (CPAN) you'll see the link to the Scalar-List-Utils-1.47 distribution. Follow that to see the modules and other files; one of those is README which contains:

This distribution is a replacement for the builtin distribution.

This package contains a selection of subroutines that people have expressed would be nice to have in the perl core, but the usage would not really be high enough to warrant the use of a keyword, and the size so small such that being individual extensions would be wasteful.

The module which originally had (as best as I remember) the uniq function is List::MoreUtils. Rather than trying to manipulate @INC, you might be better off changing

use List::Util qw{uniq};

to

use List::MoreUtils qw{uniq};

Of course, that would require your ISP (or equivalent) to have List::MoreUtils installed.

"So I installed it in my user directory, and it is version 1.47. However, I am getting an error that uniq is not exported by List::Util."

It's possible I've missed the point there somewhere; in case I haven't, I'll just point out that modules added to the 5.24.1 installation will not make them available to the 5.8.8 installation.

— Ken

Replies are listed 'Best First'.
Re^2: System vs. User module version of List::Util
by Lady_Aleena (Priest) on Jun 18, 2017 at 06:15 UTC

    When I said "from the command line", I sshed into my account, and read the perldoc there. I was not talking about from my system's command line.

    And darn it! My local List::Util has uniq.

    And this is just great, for my stuff for the browser, I am stuck with 5.8.8; but on the command line of my web host, I have 5.24.2. That's so not fair! (And not a PM problem.)

    And yes, my web host has List::MoreUtils installed, and I used it instead. Thanks!

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
      And this is just great, for my stuff for the browser, I am stuck with 5.8.8; but on the command line of my web host, I have 5.24.2. That's so not fair! (And not a PM problem.)
      This is actually something that you can probably fix.

      On the command line, run which perl to get the path to the perl binary that you're using there. Now modify the shebang line at the top of your web script to match (e.g., if which perl says /home/aleena/perlbin/perl, then, in your web script, change #!/usr/bin/perl to #!/home/aleena/perlbin/perl) and your web script should now run in the same version of Perl as you get on the command line, and with the same compile-time settings, including the default value of @INC.

        Modifying the shebang won't work, since I do not have the same set up as my webhost. So a custom shebang for my webhost would make my scripts (286 of them) fail locally. That is why I have to code for 5.8.8 (web) even though I have 5.22.2 locally and my web host have 5.24.2 at the command line.

        I am so screwed up.

        No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
        Lady Aleena

        Addendum:

        which perl returns /usr/local/cpanel/3rdparty/bin/perl.

        I don't have cpanel on my computer, so again, changing the shebang to match that would still make my local copies fail, I think.

        No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
        Lady Aleena

      BTW, you use Debian, right? You should consider to use Perlbrew.

      Regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

      Furthermore I consider that Donald Trump must be impeached as soon as possible

        I just went to the link. I don't see what Perlbrew can do for me. I only have 1 version of perl on my PC. I already install cpan modules without cpan sudo (into my $HOME directory). So what else can it do that isn't obvious?

        No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
        Lady Aleena

        Some meditative retreats might be helpful now.

        Best regards, Karl

        «The Crux of the Biscuit is the Apostrophe»

        Furthermore I consider that Donald Trump must be impeached as soon as possible

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1193034]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-20 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found