Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can Install multiple Perl versions without them tripping over each other's XS modules?

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?

like image 461
Ryan C. Thompson Avatar asked Aug 15 '10 08:08

Ryan C. Thompson


1 Answers

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.

like image 188
brian d foy Avatar answered Sep 19 '22 20:09

brian d foy