Josh Bernstein wrote:
>    After just upgrading to mod_perl2 with Apache2. My current @INC path 
> includes a "." on the end, which should  reference the current working 
> directory, and therefore correctly locate include locate in the script's 
> working directory. The problem is that the Working Directory is set to 
> "/". My question is how can I set the working directory to be the 
> location of where the script is running..... (This would make mod_perl 
> correctly locate file that I have included in the running script ie: 
> require "./file.pl")  Can this be done from within Apache?
> 
>    I've tried variations of PerlSetEnv but I can't seem to get it to 
> work. I've even read the mod_perl2 user's guide. Thanks for your help..

chdir is not a thread-safe function, (there is only one CWD per 
application) therefore the new ModPerl::Registry doesn't chdir to the 
dir of the script. We have discussed various workarounds on the dev 
list, but none of them has been applied yet.
http://mathforum.org/discussions/epi-search/modperl-dev.html
(search for 'chdir thread')

If you want to extend @INC to include some extra paths change it during 
the startup.

It's possible that we will have a special version of registry 
(ModPerl::RegistrySafeChdir) which does the right thing but you pay the 
price of a worse performance, read more about it here:
http://www.perl.com/lpt/a/2002/06/11/threads.html

It's also possible that there will be ModPerl::RegistryNonThreaded or 
something like that, which will chdir just like the registry in mod_perl 
1.0 did, which will restrict your code to run only on the prefork mpm. 
The idea that the main ModPerl::Registry should work identically across 
different mpms.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to