Re: use lib error

Adam Prime <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
I don't think Modperl::Registry sets the current working directory of of
the process when it runs your script, so that might be why it's having
problems. You can try RegistryPrefork instead, if you're running under
the prefork MPM.  If not, then your script will need to be updated to
assumed that the current working directory is /

I could of course be wrong, but this is something to try at least.

Adam

On 12/08/2016 05:17 PM, mehryar wrote:
> Hi folks,
>
> A noobie question here:
>
> I have a plain simple cgi script in a directory configured for
> Modperl::Registry:
>
> --------------------
> #!/usr/local/bin/perl
> use strict;
> use warnings
>
> use lib '../lib';
> use MyApp;
>
> print "Content-type: text/html\n\n";
> print "hello\n";
> ---------------------
>
> This script runs correctly under mod_cgi (without mod_perl), implying
> that perl is able to locate MyApp.pm through use lib '../lib';
>
> Now under mod_perl with PerlSwitches -I/Users/mehryar/Sites/lib
> the script runs correctly as well - but only if I comment out the
> 'use lib...' line. Implying again that mod_perl was able to locate
> MyApp.pm through the -I/Users/mehryar/Sites/lib.
>
> But what I don't understand is why it fails if the use lib '../lib'; line
> is present in the script?
> I get the following error:
> Can't locate MyApp.pm:   Permission denied at
> /Users/mehryar/Sites/cgi/test.cgi
> (This is on my Mac mod_perl2.0.10/Apache2.4.23)
>
> Reading the docs on how @INC is modified is getting me nowhere.
>
> cheers,
> -Mehryar
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.