Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use perlbrew to manage perl installations aimed at web applications?

I have been using perlbrew to manage multiple versions of perl on a Linux Fedora notebook. I have used it with great benefit to run command-line scripts mostly using App::cmd.

I now want to move to running web applications written using CGI::Application using different perls installed in my $HOME. I am familiar with running Perl web applications in $HOMEs using Apache's user_dir or creating Virtual Hosts but I am unable to come up with a clean way of integrating this and the perlbrew managed perls. Specifically I need help in understanding and finding answers to these questions:

  1. How do install mod_perl under perlbrew?
  2. Assuming this is done, how do I configure my VirtualHost so that it picks up the correct perl that is current?
  3. If this is not possible, (which I doubt) can I at least use local installations to run vanilla CGI?

Thank you for your attention.

like image 677
Ya. Perelman Avatar asked Sep 25 '10 18:09

Ya. Perelman


People also ask

What does perlbrew do?

perlbrew is a tool to manage multiple perl installations in your $HOME directory (or wherever you specify). They are completely isolated perl universes, and has no relationship with system perl, or between each others. This approach has many benefits: No need to run sudo to install CPAN modules, any more.

Where is Perlbrew installed?

INSTALLATION. After that, perlbrew installs itself to ~/perl5/perlbrew/bin , and you should follow the instruction on screen to modify your shell rc file to put it in your PATH. The installed perlbrew command is a standalone executable that can be run with system perl.

How do I install Perlbrew on Windows 10?

Install Perlbrew You can also install the App::perlbrew module from CPAN with cpan App::perlbrew . Or you can download and run the installation script at install.perlbrew.pl. To begin using Perlbrew, run perlbrew init .


1 Answers

I don't think this is a good use for perlbrew, which moves around symlinks under its own directory. The trick is switching the mod_perl module around. Remember, mod_perl is going to be binary-incompatible between major versions of perl, and that you will have to compile it against apache for each version of perl (and apache) you want to use.

perlbrew really does two big things for you:

  • Installs perl, which is trivially easy to do on your own.
  • Switches around symlinks so perl is whatever version you want.

If you give up on that last one, perlbrew isn't really doing that much for you. I don't think the symlink feature is particularly valuable.

I think perlbrew is fine for what it is, but when you start doing things outside of its limited scope, it's time to not use it. It's supposed to be a tool to save you some time and headache, so if it's not accomplishing that goal, it's not the right tool for your situation.

In this situation, where I'm supporting a single, big web application, I give it its own perl installation that I don't let anything else use.

For your other questions:

  1. markdown placeholder

  2. You shouldn't have to configure any VirtualHost stuff. If you are using mod_perl, perl is already in there and you don't get to choose a perl. If you're using CGI stuff, you specify the perl on the shebang line. You will have to ensure apache picks up the right library directories, but I think perlbrew handles that. You might have to use SetEnv or something similar in your httpd.conf.

  3. For vanilla CGI, just point to the right (symlink) path for whatever the default perlbrew version is. The CGI program will just use whatever perl that path points to.

like image 56
brian d foy Avatar answered Nov 15 '22 20:11

brian d foy