Don't use FindBin. It's not compatible with mod_perl since it uses
BEGIN block which is executed only ones and for correct work it should
be executed every time when the request comes.

Andrei

On Thu, Dec 09, 1999 at 12:03:56PM -0800, Joao Fonseca wrote:
> This message was sent from Geocrawler.com by "Joao Fonseca" 
><[EMAIL PROTECTED]>
> Be sure to reply to that address.
> 
> Hello,
> 
> I'm having problems migrating a site to mod_perl,
> using the Apache::Registry module.
> Scenario:
> 
> -I have 2 CGIs (cgi1 and cgi2).
> -CGI1 is a soft link, and uses FindBin:
>     use FindBin;
>     use lib "$FindBin::RealBin";
>     use MyLib;
> 
> -CGI2 is not a soft link and also uses FindBin;
> 
> After running several times, CGI1 sometimes fails
> with:
> Can't locate MyTag.pm in @INC...
> 
> After debugging, I found out that FindBin thinks
> it's running
> CGI2 instead of CGI1, and the use lib statement
> doesn't go
> to the proper location.
> 
> Here's my theory:
> 
> -On a previous request, CGI2 was run, and used
> FindBin.
>   FindBin recorded all it's info for CGI2
> (RealBin, Bin, Script,
>   and RealScript).
> 
> -Later, a request for CGI1 came, which also tried
> to use
>  FindBin.
> 
> -Apache::Registry doesn't load the FindBin module
> again.
>   Instead, uses the cached version from the
> previous request.
>   FindBin doesn't  refresh the RealBin variable,
> and the
>   use lib statement now points to the CGI2
> directory.
> 
> -Of course, MyLib isn't found in @INC, because
> it's pointing
>   to the wrong directory!
> 
> 
> Any thoughts on how to overcome this problem? I
> want to
> keep a soft link on CGI1.
> 
> Thanks,
> Joao Fonseca
> 
> 
> 
> Geocrawler.com - The Knowledge Archive

-- 

Reply via email to