You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by ArulJothi <ar...@gmail.com> on 2010/12/18 08:17:43 UTC

Can't locate .pm in @INC even though it path exists and works outside mod_perl

Dear Friends,

 I have started using mod_perl recently and facing following difficulties in
terms of running a script which depends on some custom (home grown) modules.

 When i execute Apache error log reports that it cannot locate the module in
@INC path even though the path very much exists and i am able to run the
script without any issues outside mod_perl

 Basically, Here is my setup

 1) Modules are located under /opt/tools/perl/lib
 2) @INC containts /opt/tools/perl/lib
              - This is also confirmed by http://localhost/perl-status
 3) Web perl scripts are located at /var/www/perl and apache is properly
configured
              - This is confirmed by executing a script which does not
depend on any external modules
 4) Now if i execute a perl script which has "use <module>;" pragma, it
fails if this module is located under custom path, but works well for
modules which are intalled with perl distribution

 Any clue is appreciated.

Thanks in advance,
Aruljothi.S

Re: Can't locate .pm in @INC even though it path exists and works outside mod_perl

Posted by André Warnier <aw...@ice-sa.com>.
ArulJothi wrote:
> Dear Friends,
> 
>  I have started using mod_perl recently and facing following difficulties in
> terms of running a script which depends on some custom (home grown) modules.
> 
>  When i execute Apache error log reports that it cannot locate the module in
> @INC path even though the path very much exists and i am able to run the
> script without any issues outside mod_perl
> 
>  Basically, Here is my setup
> 
>  1) Modules are located under /opt/tools/perl/lib
>  2) @INC containts /opt/tools/perl/lib
>               - This is also confirmed by http://localhost/perl-status
>  3) Web perl scripts are located at /var/www/perl and apache is properly
> configured
>               - This is confirmed by executing a script which does not
> depend on any external modules
>  4) Now if i execute a perl script which has "use <module>;" pragma, it
> fails if this module is located under custom path, but works well for
> modules which are intalled with perl distribution
> 
>  Any clue is appreciated.
> 
When it fails, there is an error message in the Apache log.
What /exactly/ does that message say ? (copy it here)




Re: Can't locate .pm in @INC even though it path exists and works outside mod_perl

Posted by ArulJothi <ar...@gmail.com>.
Torsten Fortsch,

 I just found the solution, it is very silly. /opt/optimtools points to a
directory under a user home directory which does not have enough permissions
on home directory to read.

 Anyway thanks for the effort.

Thanks & Regards,,
Aruljothi.S

2010/12/18 ArulJothi <ar...@gmail.com>

> Torsten Fortsch,
>
>  Thanks for looking into the issue.
>
>  I think i am running using mod_perl and not mod_cgi, but How to identify
> it properly.
>
>  Anyway here is my error details
>
>  *URL of my execution:* http://localhost/opt/bi.pl
>
>  *Content of bi.pl:*
>  $ cat bi.pl
>     use od_os;
>     print "hi\n";
>
> * Location of od_os.pm on web server*
>  $ ls /opt/tools/perl/od_cmn/lib/od_os.pm
> /opt/tools/perl/od_cmn/lib/od_os.pm
>
> * Error on Apache server log*
> [Sat Dec 18 18:41:38 2010] [error] Can't locate od_os.pm in @INC (@INC
> contains: /opt/tools/perl/cmn/lib /opt/tools/perl/od_cmn/lib
> /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
> /usr/local/lib/perl5/site_perl/5.10.0
> /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
> /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl
> /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0
> /usr/lib/perl5/site_perl . /etc/httpd) at /var/www/optim/bi.pl line
> 1.\nBEGIN failed--compilation aborted at /var/www/optim/bi.pl line 1.\n
>
> Thanks & Regards,
> Aruljothi.S
>
> 2010/12/18 Torsten Förtsch <to...@gmx.net>
>
> On Saturday, December 18, 2010 08:17:43 ArulJothi wrote:
>> >  When i execute Apache error log reports that it cannot locate the
>> module
>> > in @INC path even though the path very much exists and i am able to run
>> > the script without any issues outside mod_perl
>> >
>> >  Basically, Here is my setup
>> >
>> >  1) Modules are located under /opt/tools/perl/lib
>> >  2) @INC containts /opt/tools/perl/lib
>> >               - This is also confirmed by http://localhost/perl-status
>> >  3) Web perl scripts are located at /var/www/perl and apache is properly
>> > configured
>> >               - This is confirmed by executing a script which does not
>> > depend on any external modules
>> >  4) Now if i execute a perl script which has "use <module>;" pragma, it
>> > fails if this module is located under custom path, but works well for
>> > modules which are intalled with perl distribution
>>
>> Are you sure the scripts are run by mod_perl instead of mod_cgi? If you
>> are
>> using mod_cgi use SetEnv to propagate the custom search path to the
>> module.
>>
>> Torsten Förtsch
>>
>> --
>> Need professional modperl support? Hire me! (http://foertsch.name)
>>
>> Like fantasy? http://kabatinte.net
>>
>
>

Re: Can't locate .pm in @INC even though it path exists and works outside mod_perl

Posted by ArulJothi <ar...@gmail.com>.
Torsten Fortsch,

 Thanks for looking into the issue.

 I think i am running using mod_perl and not mod_cgi, but How to identify it
properly.

 Anyway here is my error details

 *URL of my execution:* http://localhost/opt/bi.pl

 *Content of bi.pl:*
 $ cat bi.pl
    use od_os;
    print "hi\n";

* Location of od_os.pm on web server*
 $ ls /opt/tools/perl/od_cmn/lib/od_os.pm
/opt/tools/perl/od_cmn/lib/od_os.pm

* Error on Apache server log*
[Sat Dec 18 18:41:38 2010] [error] Can't locate od_os.pm in @INC (@INC
contains: /opt/tools/perl/cmn/lib /opt/tools/perl/od_cmn/lib
/usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.0
/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0
/usr/lib/perl5/site_perl . /etc/httpd) at /var/www/optim/bi.pl line
1.\nBEGIN failed--compilation aborted at /var/www/optim/bi.pl line 1.\n

Thanks & Regards,
Aruljothi.S

2010/12/18 Torsten Förtsch <to...@gmx.net>

> On Saturday, December 18, 2010 08:17:43 ArulJothi wrote:
> >  When i execute Apache error log reports that it cannot locate the module
> > in @INC path even though the path very much exists and i am able to run
> > the script without any issues outside mod_perl
> >
> >  Basically, Here is my setup
> >
> >  1) Modules are located under /opt/tools/perl/lib
> >  2) @INC containts /opt/tools/perl/lib
> >               - This is also confirmed by http://localhost/perl-status
> >  3) Web perl scripts are located at /var/www/perl and apache is properly
> > configured
> >               - This is confirmed by executing a script which does not
> > depend on any external modules
> >  4) Now if i execute a perl script which has "use <module>;" pragma, it
> > fails if this module is located under custom path, but works well for
> > modules which are intalled with perl distribution
>
> Are you sure the scripts are run by mod_perl instead of mod_cgi? If you are
> using mod_cgi use SetEnv to propagate the custom search path to the module.
>
> Torsten Förtsch
>
> --
> Need professional modperl support? Hire me! (http://foertsch.name)
>
> Like fantasy? http://kabatinte.net
>

Re: Can't locate .pm in @INC even though it path exists and works outside mod_perl

Posted by Torsten Förtsch <to...@gmx.net>.
On Saturday, December 18, 2010 08:17:43 ArulJothi wrote:
>  When i execute Apache error log reports that it cannot locate the module
> in @INC path even though the path very much exists and i am able to run
> the script without any issues outside mod_perl
> 
>  Basically, Here is my setup
> 
>  1) Modules are located under /opt/tools/perl/lib
>  2) @INC containts /opt/tools/perl/lib
>               - This is also confirmed by http://localhost/perl-status
>  3) Web perl scripts are located at /var/www/perl and apache is properly
> configured
>               - This is confirmed by executing a script which does not
> depend on any external modules
>  4) Now if i execute a perl script which has "use <module>;" pragma, it
> fails if this module is located under custom path, but works well for
> modules which are intalled with perl distribution

Are you sure the scripts are run by mod_perl instead of mod_cgi? If you are 
using mod_cgi use SetEnv to propagate the custom search path to the module.

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net