Perrin Harkins | 1 Jul 2007 16:26

Re: Problems using Apache::Reload

On 7/1/07, Clinton Gormley <clint <at> traveljury.com> wrote:
> This is one of the gotchas I mentioned before: CHDIR.
>
> You can't rely on it.  Something somewhere (maybe Registry itself) is
> changing the current dir, so '.' now refers to / rather than
> to /path/to/your/modules.

It's actually not that something is doing a chdir, but that Registry
is NOT doing one.  In a CGI environment, the current directory is
always set to the directory where the script lives.  Unfortunately,
this is not safe for a threaded environment, so Registry doesn't do it
by default.

A subclass of Registry that deals with this is included in the
mod_perl distribution.  It's called ModPerl::RegistryPrefork.  There's
more explanation here:
http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__Registry___C_Apache__PerlRun__and_Friends

- Perrin


Gmane