views:

125

answers:

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?
A: 

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
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
@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
+4  A: 

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
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
perlbrew description: perlbrew is a program to automate the building and installation of perl in the users *HOME*...
mfontani
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
After some reading, this seems to be the safest while still being easy. Trying it right now, will let you know.
Joel
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
There you go, enjoy your new perl! Next step, use App::cpanminus to install modules ;)
mfontani
A: 

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