Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run multiple Perl installs on one machine?

Tags:

perl

Is it possible to run multiple installs of Perl (in "containers") on one machine?

Reason is that I have different Perl-based server side web applications and wish to schedule updates to them independently.

For example, bugzilla upgrades seem to me to be very invasive, downloading all manner or module updates and lengthy, too (thereby increasing the chance of unpredictable behavior on other applications that depend on those modules, during the time that the upgrade is still partial).

I think it should be possible to run multiple independent server-side CGI Perl applications on one server, I'd rather not be told to separate them onto different machines - I think that's wasteful and I don't have that resource anyway.

like image 809
therobyouknow Avatar asked Jun 29 '11 08:06

therobyouknow


2 Answers

Investigate PerlBrew and cpanm:

http://qa.celogeek.com/programming/perl/for/developer/overview

Edit, more info:

http://www.bryanesmith.com/documents/a2pm/perlbrew-june-14-2011.pdf

http://www.dagolden.com/index.php/1384/parallel-make-for-perlbrew/

http://www.perlbrew.pl/

like image 190
Raoul Avatar answered Oct 26 '22 12:10

Raoul


It's easy to install and manage multiple perls. Simply install them in different places and use each perl's tools. I talk about this in The Effective Perler.

Some people suggest perlbrew without realizing that it doesn't really give you any benefit. It can download a perl, configure and install it, and switch around symbolic links to make one of those the default. It doesn't do anything magical, though.

Downloading and installing aren't a problem though. You've never needed root or sudo to do that, and if you do, you'll still need it for perlbrew. You can always install into any directory where you have permission. perlbrew doesn't get around that at all. From the source directory, you have two simple commands to run:

 $./Configure -des -Dprefix=/where/you/want/to/install
 $ make install

For you, that might mean Bugzilla gets its own perl:

 $./Configure -des -Dprefix=/where/you/want/to/install/bugzilla-perl
 $ make install

From there, you have a completely self-contained perl installation. When it matters to me which perl I use, I give the program the full path to it:

 #!/where/you/want/to/install/bugzilla-perl/bin/perl

It's much easier to make these per-applications installations without perlbrew, which wants to do as much as it can for you, including deciding the directory name, which it prefers you didn't know at all.

perlbrew's main advantage is not the compilation and installation, but it's switch feature to let you make one perl the default. You probably don't want that feature though because you want bugzilla, CGI programs, and so on using only the perl you want them to use, not whatever default perl you last specified.

When you want to update the bugzilla-perl, just use it's tools, which already have adjusted shebang lines to find the right perl:

 $ /where/you/want/to/install/bugzilla-perl/bin/cpan ...

I don't like all of those long paths, though, which is why I make links to them all. Then I can just call them with whatever naming scheme I decide, which might be:

 $ bugzilla-cpan ...

There's never a question about which tool or version I'm using.

like image 31
brian d foy Avatar answered Oct 26 '22 14:10

brian d foy