views:

126

answers:

1

I would like to install several different versions of perl in my home directory. I tried using App::perlbrew, but XS modules from one version were causing segfaults in the other version. Is there any way to install multiple versions of perl and have them automatically keep their XS modules separate?

+5  A: 

You can install each perl completely separate from any other perl installation. It's binaries and modules will be completely separate from each other. Essentially, when you install each perl you give it its own prefix:

 $ ./Configure -des -Dprefix=/usr/local/perls/perl-5.12.1

Everything is installed under that prefix, and all of the programs in the bin/ will use that particular perl. I go into this in more depth in Effective Perl Programming.

From there, I make symlinks in my ~/bin to each of those programs and attach the version number to it, so I have ~/perl5.12.1, perldoc5.12.1, and so on. I don't ever have to choose to have a version in the way that perlbrew wants you to. I write more about this in Make links to per-version tools. in the Effective Perler blog.

You might be able to use local::lib for this, but it's really designed for you to work with one version of Perl and use one personal library directory. You can tell it to use another directory, but at that point it's really not saving you anything over the traditional way.

brian d foy
Thanks for clarifying that local::lib is for a single version only. I have disabled local::lib and perlbrew seems to be doing just fine on its own.
Ryan Thompson
I think -Dprefix might not be enough; I ended up with one perl installation that put all its libs in the right place, but still used /usr/local/bin for executables. I haven't yet gone back to see what happened, so I just mention this as a footnote warning folks to be careful what configurations are generated via -es.
Ether
So, is there a way for local::lib to work correctly with multiple perl versions and XS modules, or should I disable it and just let perlbrew handle everything?
Ryan Thompson
Well, I don't use either local::lib or perlbrew. So, that's my opinion. :)
brian d foy