Multiple perls on one box, some tips and tricks

ivorw on 2006-10-24T07:41:31

Why you might want to do this

Maybe, the perl on the host you are running on, is one you have no control of. It could be that the hosting company or your employer, doesn't allow you root access. Maybe you want a more up to date perl than that provided.

Another reason is to have a "virgin perl" to use with the CPAN testers' YACSmoke programme. There are advantages to using the minimum installation: you'll pick up module dependencies that many smoke testers would miss. This would be completely separate from your "working perl", which has all the modules you need to do your work, and for the sysadmins, and the package installers.

In my case, it's the latter reason. I'm using Debian (Sid actually, and so the perl and packaged modules are pretty up to date), and am setting up two "virgin perls", one with 5.8.8 and one with bleadperl. I've created user accounts specially for the purpose.

I've not tried this on Windows. Maybe it's possible to have a vanilla perl installed elsewhere to C:\Program files, outside the path for normal operations.

Planning and execution

Decide on where you want to put your perl. In my case, this has involved creating new user accounts. In my case, the perl will live under /home/perl-base.

Obtain the tarball for the perl you want. Untar this into a build directory. In my case, /home/perl-base/perl-5.8.8 is fine: I untar as user perl-base in the user's home directory. cd into the top level directory.

We're going to vary from the normal mantra given in the INSTALL document. Run the command ./Configure -de to generate the files config.sh and Policy.sh. If this encounters any problems, BAIL OUT! These would indicate an issue on your O/S platform; most of these have been ironed out over time, but this still could be something worth reporting to p5p via perlbug, especially if you are messing with bleadperl.

We're going to throw away the config.sh, but keep the Policy.sh. Remove config.sh, but edit Policy.sh. Globally replace /usr/local with your destination install base directory, in my case /home/perl-base. Uncomment the shell variable lines that you have changed.

Now, run ./Configure again. In my case I use -de again as I'm building a perl with default configuration - your mileage may vary.

Run make, make test and make install. You don't need to run the make install as root.

You may need to edit .bash_profile to add the new bin directory to your path. In my case, the boilerplate .bash_profile contained code to add the user's bin directory to the path if it exists, so I just needed to source in .bash_profile. You might be using a different shell to bash - ymmv.

perl -V and voilà


Using different CPANPLUS User Configs

BinGOs on 2006-10-24T10:10:01

If you are using a modern CPANPLUS then you can trick it into using different user configs by setting or changing the APPDATA environment variable.

That's the long about way.

Abigail on 2006-10-24T10:45:48

You can all that by just running Configure once, and no editing of files.

As explained in the INSTALL file, you can give an option to Configure to tell it where to install perl. -Dprefix=/home/perl-base/perl-5.8.8 will do.

I typically run Configure something like this:

./Configure -des -Dusedevel -Dprefix=/opt/perl/5.9.4 -Dusemorebits -Doptimize=-g -Dusemorebits -Uversiononly -Dmydomain=.abigail.be -Dcf_email=abigail@abigail.be -Dperladmin=camel@abigail.be -Dcc=gcc

Here's one I prepared earlier...

Alias on 2006-10-24T14:27:37

Yes, you COULD do this.

OOOOORRRRRR, you could use one that was prepared earlier for PITA to run inside of.

http://pitatesting.net/guests/sarge-x86.img.gz (582 meg)

This is a disk image for use with the qemu emulator.

It has no less than EVERY single significant production Perl from and including the last 5.004 up to 5.8.8 pre-installed for you already.

My install instructions

jdavidb on 2006-10-24T17:44:33

I need to get around to updating these, but they're still pretty good:

http://use.perl.org/user/jdavidb/journal/6477

Just goes to show

hex on 2006-10-24T21:20:03

The comments on this entry clearly demonstrate that there is more than one way to do it. :)