(or: Gosh, I wish I found this out a decade ago)
Now and then I need to install perl modules outside the regular library dirs. Most often because of an temporary installation in userspace but also when I use FINK to quickly install complex bundles on my powerbook. Since it’s most often just is a temporary installation for debugging or development purposes I’ve coped with adding an extra -I parameter to the shebang. Until last night when I fell over this monster API from hell. Not only did it demand an enormous amount of dependencies to be installed – it looked like every goddamn single 4-row test program and module needed each one of them.
For evaluating I would have to spend the whole night modifying source code. So I said ”fuck it” and googled away.
The solution was of course painfully simple.
In ten years of tinkering with Apache I’ve managed to miss the directive that loads the mod_env module which can be use
to modify the environment variables that is set before calling CGI-scripts. Two rows to uncomment and asimple directive to add to the config:
SetEnv PERL5LIB ”/path/to/libs”
mod_env’s directives can even be used in .htaccess overrides. Damn. After all these years …