3

I have seen plenty of people mention some of the cool new features in Perl >= 5.12 but my preferred flavor of Linux Ubuntu only comes with 5.10.1.

I have no fear of PPAs and I know how to google (unless someone finds me something, then I'll feel sheepish). I cannot find someone that provides a Perl PPA; I thought there was a PPA for everything!

My further fear is that since linux-based OSes use perl as part of their packaging and other systems I don't necessarily want to venture out on my own to compile/install it for fear of breaking my OS.

Can someone give me some guidance on the easiest while still safest way to upgrade/parallel-install the newest Perl versions?

  • Can I specify multiple binaries in a good way to not affect system utilities?
  • How do the Modules work if multiple versions of Perl are installed?
Ether
  • 53,118
  • 13
  • 86
  • 159
Joel Berger
  • 20,180
  • 5
  • 49
  • 104
  • acceptable with @ether 's edit. Related to http://stackoverflow.com/questions/398221/how-do-you-manage-perl-modules-when-using-a-package-manager – Jeff Atwood Oct 24 '10 at 01:02
  • See also http://stackoverflow.com/questions/1289564/how-should-i-install-more-than-one-version-of-perl – Ether Oct 24 '10 at 01:15

3 Answers3

7

I'd recommend taking a look at the excellent perlbrew, available from CPAN, which allows you to locally install and manage multiple perl versions.

tjmw
  • 299
  • 2
  • 4
  • I have seen this before but haven't tried it for fear of messing up the system perl. When perlbrew is used does it change the system's version of perl? How do I use my higher version but still let the system use 5.10.1? – Joel Berger Oct 23 '10 at 20:39
  • 2
    perlbrew description: perlbrew is a program to automate the building and installation of perl in the users *HOME*... – mfontani Oct 23 '10 at 21:57
  • 2
    Have a read through the perlbrew documentation - I think your questions are answered there. In short perlbrew won't interfere with your system perl. Any time you want to stop using perlbrew and revert to using the system perl you can do so (with perlbrew off). Of course, even with perlbrew turned on you can always invoke the system perl by using its full path (for example /usr/bin/perl). – tjmw Oct 23 '10 at 22:50
  • After some reading, this seems to be the safest while still being easy. Trying it right now, will let you know. – Joel Berger Oct 24 '10 at 02:00
  • Seems to work: `$ perl -v` -> This is perl 5, version 13, subversion 3 (v5.13.3). `$ sudo perl -v` -> This is perl, v5.10.1 (*). – Joel Berger Oct 24 '10 at 02:35
  • There you go, enjoy your new perl! Next step, use App::cpanminus to install modules ;) – mfontani Oct 24 '10 at 12:00
1

You sound more like your trying to replace the dist perl, you don't want to do that. You want to install a separate perl. Because of all the baggage associated with the perls, I usually install them as a separate user in their home and then export out like a /opt or what not.

hpavc
  • 1,336
  • 7
  • 7
0

What I do is, compile my own perl and install it in /opt/perl. Then, I add export PATH=/opt/perl/bin:$PATH to my .bashrc. Thus the system perl remains intact and I have the latest perl to play with. :-)

Alan Haggai Alavi
  • 72,802
  • 19
  • 102
  • 127
  • You shouldn't use `/opt`, at least not on OSX, as that is the base directory used by the [macports](http://macports.org) package distribution system. – Ether Oct 23 '10 at 21:48
  • @Ether: /usr/local is probably better, yes, but /opt is certainly allowed. In theory (http://pathname.com/fhs/pub/fhs-2.3.html#OPTADDONAPPLICATIONSOFTWAREPACKAGES) macports, etc. should not overwrite things users place in /opt – ysth Oct 24 '10 at 15:50
  • Regarding `/opt` vs `/usr/local`, see: http://unix.stackexchange.com/a/11552/26227 – Dave Jarvis Mar 25 '13 at 01:29