[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PERL5LIB and Apache2


Hi All --

I'm in the process of migrating a mod_perl site from Apache 1.3 to
Apache 2.  I'm using RedHat ES4, which ships with Perl 5.8.5, Apache
2.0.52, and mod_perl 1.99_16.

Problem is, I can't seem to get PERL5LIB working as expected.  Under
Apache 1.3, following was in the <VirtualHost> block:


     PerlSetEnv PERL5LIB  '/path/to/my/modules'
     PerlRequire "conf/startup.pl"
     <FilesMatch "^.*\.pl$">
       SetHandler perl-script
       PerlHandler Apache::Registry
     </FilesMatch>


This was sufficient to insure that all ".pl" files used the correct
libraries.  Under Apache2, this does not appear to be the case.  I
have changed the above block to as follows:

     PerlSetEnv PERL5LIB  '/path/to/my/modules'
     PerlTaintCheck Off
     PerlModule perl5lib
     PerlRequire "conf/startup.pl"
     <FilesMatch "^.*\.pl$">
       SetHandler perl-script
       PerlHandler ModPerl::Registry
     </FilesMatch>


Still I get errors when I try to run scripts which use modules:

 Can't locate Foo/Bar.pm in @INC


Odder still(!), is that $ENV{PERL5LIB} *does* report correctly if I
dump it in a BEGIN block!  In fact, if I add the following to my
scripts, they *DO* work:

   BEGIN {
     my @libs = split(/:/, $ENV{PERL5LIB});
     unshift(@INC, @libs);
   }


Unfortunately, this would have to be added to every script.  I'm not
opposed to doing it, but it seems like there ought to be a better way.
Any ideas?

(FYI, I've tried both "PerlSwitches -I" and "PerlSwitches -Mlib=", to no avail.)


Thanks!

-Jesse-


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.