Gday fellow mod_perl'ers,

In order to get mod_perl to look in the right place for my perl
modules, I have been using the "SetEnv PERL5LIB /foo" method in my
apache config file.

This is giving me bad results when I use more than one mod_perl module.

To my knowledge, the way this works is that when the perl interpreter
is loaded, it prepends the normal @INC paths with the directory[s] in
your PERL5LIB environment variable.

What I'm finding is that when the first mod_perl module loads, it uses
the PERL5LIB variable to build up an @INC list. Then when the second
mod_perl module is called, it's not rebuilding the @INC path.

Say I have an apache config like so:

<Directory /foo>
    SetEnv PERL5LIB /tmp/foo
</Directory>

<Directory /bar>
    SetEnv PERL5LIB /tmp/bar
</Directory>

If I load a mod_perl module from the /foo directory, then the @INC for
perl contains /tmp/foo. If that mod_perl script then does an internal
redirect to another mod_perl module in /bar, then the @INC path is not
rebuilt with the new environment.

This is relevant for PerlAuthzHandler's and such, as they are loaded by
apache first, as mod_perl modules. Then once authenticated, they do
some sort of internal redirect to the original request. If this
original request was for a mod_perl module, then it doesn't recieve
it's appropriate @INC. The environment variables are all set properly,
ie: PERL5LIB is what is supposed to be, it's just that the @INC hasn't
be rebuilt.

Does anyone know if this is a bug in mod_perl? I have found a way
around it by just manually pushing the environment variable onto the
@INC before the second mod_perl module is called. But I believe this is
an incorrect way of doing things.

cheers
Danial Pearce

Reply via email to