-----Original Message-----
>From: Adam Prime <[EMAIL PROTECTED]>
>Sent: Jan 18, 2008 6:22 AM
>To: c chan <[EMAIL PROTECTED]>
>Cc: modperl@perl.apache.org
>Subject: Re: question on startup.pl overriding perl search path
>
>c chan wrote:
>> I use "PerlConfigRequire /var/www/html/mypath/startup.pl" in httpd.conf to 
>> recompile all the CGIs. Inside startup.pl, 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 startup.pl 
>> 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
>
>http://perl.apache.org/docs/2.0/user/config/config.html#C_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
>
>Adam

Reply via email to