Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

[SITE] Can't locate foo.pm in @INC

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


dprice at plugnpay

Jan 3, 2005, 12:15 PM

Post #1 of 2 (425 views)
Permalink
[SITE] Can't locate foo.pm in @INC

I will apologize in advance if the following explanation is not clear.
I had a hard time trying to describe it.

I am setting up a light/heavy reverse proxy. I'm using ProxyRemoteAddr to
capture the forwarded IP address of the client.

The heavy version using Mod_Perl.

Environment is Solaris 8.

All custom perl modules are stored in a "non-standard" directory and the
scripts that reference these modules all have a 'use lib' statement so the
scripts know where to find the appropriate modules.

When running the servers without 'ProxyRemoteAddr' everything works fine.

When 'ProxyRemoteAddr' is enabled I encounter the following error:

Can't locate foo.pm in @INC

When 'ProxyRemoteAddr' is disabled the problem goes away.

Example. Testscript.cgi will has several 'require foo' statements to load
modules as they are required depending on how this script is called. So if
it is called with one set or parameters it will execute 'require foo;'
called with a different set of parameters it may execute 'require fee;'
instead.

Running with 'ProxyRemoteAddr' enabled I can call testscript.cgi without a
problem as long as I don't vary the parameters it is sent. After the first
call any change which requires it to load a new module via the 'require
fee;' command will cause the script to die with the error 'Can't locate
fee.pm in @INC).


When using the light heavy configuration I can run a script multiple times
as long as the script only requires the same set of modules each time. If I
call the script with a different set of parameters which would require it to
call a different set of modules then it dies with the error message that it
could not find the requested module in @INC. If I reverse the order the
error still happens when the script is called the second time.

I traced this issue to the use of: ProxyRemoteAddr. If I do not call this
routine then the problem does not occur. It is as if the module list is
"locked" when the script is first called and subsequent calls will not load
any new modules.

If I add the 'use lib' statement to a startup script so it loads the library
directory the problem will go away, as far as the limits of my testing are
concerned.

I would however like to understand why this is occurring.

Any help/insight is greatly appreciated.

Thanks.




--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


perrin at elem

Jan 3, 2005, 4:05 PM

Post #2 of 2 (379 views)
Permalink
Re: [SITE] Can't locate foo.pm in @INC [In reply to]

On Mon, 2005-01-03 at 15:15 -0500, David Price wrote:
> I am setting up a light/heavy reverse proxy. I'm using ProxyRemoteAddr to
> capture the forwarded IP address of the client.

Are you talking about the sample My::ProxyRemoteAddr module from the
docs? I doubt that this is actually related to the problem.

> The heavy version using Mod_Perl.

You should always tell us which version. See
http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems

> If I add the 'use lib' statement to a startup script so it loads the library
> directory the problem will go away, as far as the limits of my testing are
> concerned.

I think what's happening here is that the @INC reverts to its original
value after the script is run, and "use lib" is only executed once, at
compile time. That means that in later requests, the directory is not
in your @INC. Most people load all modules at compile time (you
probably should too) so they don't see this. The fix is just what you
described: do it in startup.pl or set PERL5LIB.

For more info:
http://perl.apache.org/docs/1.0/guide/install.html#Making_Your_Scripts_Find_the_Locally_Installed_Modules

- Perrin


--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.