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

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

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


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