Closed lguez closed 3 years ago
You need a newer version of Getopt::Long. You can either upgrade Getopt::Long (and I can help you with that) or you need a Perl that is at least v5.17.10, which is the first one that came with Getopt::Long 2.39. I need to put something in the docs about this.
I'm guessing RHEL 6 or CentOS 6 ? (There are probably other legacy and stability Linux OSs still running 5.10.1, but EL6 is the usual.)
TL;DR These comments are background explaining further WHY the general problem you've backed into even exists, and how IT departments deal with it; Andy's advice is on-point for a single user in that environment.
Yeah, those super-stable long-term support RedHat Linuxes have really old /bin/perl
... which is good for stability of the built-in OS scripts in the super-stable LTS RHEL/CentOS, but not so good for taking latest versions of things.
But taking the latest version of Ack etc is contrary to having the super stable release, where one does not want to import change (except security patches and critical functional patches).
In $HOME
it may be fine, of course, but it won't work with /bin/perl
.
Which is half of why the general advice is to use /bin/perl
(or /usr/bin/perl
, whichever) only for scripts installed in /bin
/usr/bin/
and the like, and have a perlbrew
or other add-on newer Perl in local application install directories or personal $HOME
.
(The other half of reasons is that having a local application script break because the system Perl was updated in an OS upgrade / move to a new OS, thus invalidating XS modules installed outside of YUM when the XS api has big-revision API change, is very unpleasant.
A corporate local app having its own captive Perl interpreter with whole stack of Perl Libs protects from this.)
OTOH if you for reasons want a modern system Perl, despite above advice, you should be able to find in the RPM repos a "alternates" package for any Perl up to 5.28 for el6; near as i can tell, 5.30 is only in el7 el8 and Centos 8 Stream. That will have perl
-> perl5101
and perl528
-> perl5283
or whatever, but if you reorder your personal $PATH
in .bash_rc etc
to put /opt/perl528/bin
or wherever it puts it ahead of /bin
and /usr/bin
, for you perl
-> perl5283
in that process tree only.
(System processes must still have the antique 5.10.1 first in their $PATH
for guarantee of system management working! Don't want to take slightest chance of breaking "sudo yum" or backups ... many system things use the /bin/perl
and may rely on /usr/lib/perl
XS compiled libraries which will break if script run with 5.28 or 5.30.)
(OTOH All of my above is IT style advice ... which is addressed to those mandating LTS EL6. For a single user, the simplest thing is to have an extra directory tree on $PERLLIB path with the new Getopt::Long 2.39 ... which is what Andy is suggesting. That can be under $HOME or for shared use under some common directory and added to common profile include.)
Thank you petdance and n1vux. The machine I am on has Scientific Linux release 6.10. It is the machine for a university department and I am not an administrator of the machine. So, yes, petdance, I would appreciate help on upgrading Getopt::Long. If I understood well, this is the lightest solution to the problem. (I do not know or use Perl at all, except black-box scripts such as ack.)
If you're not an admin on the machine, I'm not sure what to do. I understand that you can install modules locally but I don't know the best practices for that. Maybe Bill can help.
FIxed in d406db9d2011f38d374eb1a409a6b8c768729eca. This will be released in 3.4.1.
Hello. I have downloaded the single-file version of ack 3.4.0. It does not work:
I am on a Linux machine, with perl 5.10.1. What is wrong? I thought this file file was self-sufficient.