in reply to using perlbrew with apache

So OK, it feels a bit clunky because I have to modify every script every time I change perls,

It is clunky. In theory, you should relaunch the script's installer using the new perl. But since you're doing the installation manually, you have to do this manually too.

But it can easier than the way you're doing it. Create a symlink to the `perl` you want to use in production, and use that symlink in the shebang. When you've installed a new version of `perl` and you've tested it with your web app, just update the symlink.

So I add another hack that discovers the perl running the script and adds that to the 'system' call that runs the application.

Sounds like you forgot to update a shebang.

But I have a nagging worry about which libraries it's using and it all feels kludgy.

@INC is hardcoded into the installation. As long as you don't add anything using PERL5LIB or similar, you'll get the right perl installation's modules.

Replies are listed 'Best First'.
Re^2: using perlbrew with apache
by Dave Howorth (Scribe) on Feb 15, 2016 at 16:28 UTC

    Thanks. I've now got it working. I pointed the shebang line in the CGI script to the perlbrew perl (I'll probably change that to a symlink as you suggest at the next go-around). Then I assigned to $ENV{PERLBREW_ROOT} and $ENV{PERLBREW_HOME} in the CGI script before running an application. All the applications have !#/usr/bin/env perl shebangs in the usual way and that seems to work. Thanks for the reassurance about the libraries.