Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to downgrade to perl 5.10.1?

Tags:

perl

downgrade

I'm running into lots of issues with perl modules requiring perl(:MODULE_COMPAT_5.10.1):

Error: Package: perl-Class-MOP-1.12-1.el6.x86_64 (epel)
           Requires: perl(:MODULE_COMPAT_5.10.1)
Error: Package: perl-Moose-1.15-1.el6.x86_64 (epel)
           Requires: perl(:MODULE_COMPAT_5.10.1)

The installed perl version is 5.16.3, OS is Amazon Linux AMI release 2014.03, and I'd very much like to downgrade to perl 5.10.1 so that the compat issues are fixed. How do I do this?

This happens in particular when I try to install perl-Net-Amazon-EC2, here's what yum list shows:

perl-Net-Amazon-EC2.noarch 0.14-2.el6 epel

So it's coming from epel and here's a corresponding section of repo file:

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

Seems like version in repo is 0.14 and the latest is 0.24 (I've tried installing it manually, but it did not work and I in any case don't want to install manually for all the packages)

like image 422
Fluffy Avatar asked Apr 08 '14 10:04

Fluffy


1 Answers

The easiest thing to do is install Perlbrew. It is Linux/Unix specific, and uses BASH. If you use Zsh or Kornshell, you need to munge the scripts a wee bit. If you're on Windows, well... good luck.

Perlbrew will allow you to install multiple versions of Perl as user installed Perls. You don't need root permission to use these various versions of Perl You can also run CPAN via Perlbrew to install modules in the various versions of Perl. This is a great way to install multiple versions of Perl for testing purposes. My default Perl is 5.16, so I've installed 5.18 to get the latest, 5.10, 5.12, and 5.8.9 to match as closely as possible the version of Perl we run on our RHEL servers.

To switch from one version of Perl to another, you use this command:

$ perlbrew use 5.10   # Use this version in the current shell

or

$ perlbrew switch 5.10  # This is now your default version of Perl

To install a particular version of Perl:

$ perlbrew install 5.10  # I'm installing Perl 5.10!

Perlbrew uses $PATH to set your Perl version, so you need to be careful with your shebang. You're not necessarily running Perl under /usr/bin/perl anymore. You shebang in your Perl scripts should be:

#! /usr/bin/env perl

Way easier than attempting to downgrade your default installed Perl.

like image 107
David W. Avatar answered Oct 27 '22 04:10

David W.