How do I add a script specific lib path in mod_perl?

apache, mod-perl, mod-perl-registry, perl

Solution

use File::Basename;
use lib dirname( __FILE__ );

Problem

I'm trying to migrate CGI scripts to `mod_perl` using `ModPerl::Registry`. The scripts use modules that are in the same directory as the script, but since `mod_perl` current directory is elsewhere, that doesn't work. I tried using `FindBin` to add on to the `@INC`, but here's what `FindBin` looks like: ``` $FindBin::Bin: /usr/sbin $FindBin::Script: httpd ``` Which is no use at all. So, is there a way for the script to figure out where it is, and add that directory to `@INC`? Ideally, all the other scripts using the same Apache server wouldn't get that directory added to their `@INC`.

Original source