views:

97

answers:

1

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.

+2  A: 

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 against major version 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, it gets 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.

brian d foy