[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modperl
Subject: Re: use lib error
From: mehryar <mehryar () mehryar ! com>
Date: 2016-12-09 16:28:31
Message-ID: alpine.DEB.2.02.1612090819090.5657 () neon ! he ! net
[Download RAW message or body]
Thanks Adam, I think you were right.
There was a small difference in the simplified example I wrote below to
the actual script I was running. The actual script actually had the path:
use lib '../../lib'; # which was correct relative to the script.
But when I switched this to:
use lib '../lib'; # this did not cause the error anymore, even though the
path was incorrect relative to the script.
And I think what was happening was that you're right the current working
directory was being set to / and ../../lib was an invalid path somehow.
Anyway I adopted your solution and just removed the use libs in my scripts
since the PerlSwitch -I/{full path to lib} allows the modules to be found.
cheers,
Mehryar
On Thu, 8 Dec 2016, Adam Prime wrote:
>
> 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
>
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic