perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c chan <>
Subject Re: question on overriding perl search path
Date Sun, 20 Jan 2008 05:43:14 GMT

-----Original Message-----
>From: Adam Prime <>
>Sent: Jan 18, 2008 6:22 AM
>To: c chan <>
>Subject: Re: question on overriding perl search path
>c chan wrote:
>> I use "PerlConfigRequire /var/www/html/mypath/" in httpd.conf to recompile
all the CGIs. Inside, I added the line:
>>   use lib qw(. mylib);
>> To me amazement, after all the CGI is precompiled, they start to look into the "."
and "mylib" path for loading Perl Modules without even having the line [use lib qw(. mylib);]
incorporated in each individual cgi script. 
>> Can someone explain to me why this is the case? Is the mod_perl script
simply becomes the parent apache process for all the preloaded CGIs?
>This is normal.  Under mod_perl the perl interpreter just keeps running 
>until the apache child dies your modified @INC stays modified.  I'm sure 
>someone with a better understanding of the internals can give a more 
>detailed 'why'.  FYI though, you should probably use PerlPostConfigRequire
>> If I remove mod_perl, can I use the 
>>   PerlSetEnv -I/var/www/html/mypath -I/var/www/html/mypath/lib 
>> to achieve the same result.
>Isn't PerlSetEnv part of mod_perl?  In which case, no that wouldn't work 
>if you'd removed mod_perl
Thank you for your clarification. To make the CGI scripts both work under Apache and mod_perl,
I put the "use lib qw(...);" in everyone of them.

- Clement 
>> This will make a profound effect on my CGI directory because whatever I installed
will no longer affect the system perl module search path. In effect, this will make my application
self contained and making trouble shooting make easier.
>> - C Chan

View raw message