perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Gormley <cl...@traveljury.com >
Subject Re: problem calling a file under mod_perl2
Date Mon, 28 May 2007 10:10:29 GMT
Hi Alicia

The handling of the current working directory has changed from mod_perl
1 to mod_perl 2.

In mod_perl1, mod perl registry  used to chdir into the script's
directory.

This no longer happens as mod_perl2 has to support threads, and chdir is
not thread safe - it would affect all other threads.

Instead, the safest way to work around it is
a) specify the absolute path to perl_functions.pl
b) add the directory where perl_functions.pl lives into @INC by doing
this in your startup.pl file:

   use lib qw(/path/to/perl_functions/dir/);

Clint

On Mon, 2007-05-28 at 11:55 +0200, Alicia Amadoz wrote:
> Hi,
> 
> I have a problem loading a perl file under mode_perl2. I want to reuse
> some subrutines that I have in 'perl_functions.pl' file and I am trying
> to call this file from 'search.pl' file. 
> 
> I get this error:
> 
> Can't locate ../perl_functions.pl in @INC 
> 
> My configuration is the following:
> 
> In httpd.conf:
> 
> PerlPostConfigRequire
> /usr/local/apache2/htdocs/www/p_scripts/perl-cgi/startup.pl
> 
> In startup.pl:
> 
> use lib
> qw(/usr/local/apache2/htdocs/www/p_scripts/perl-cgi);
> 
> In search.pl:
> 
> require "../perl_functions.pl"; 
> 
> 'startup.pl' and 'perl_functions.pl' are in the same folder but
> 'search.pl' is in a subfolder.
> 
> I would appreciate any suggestion regarding how to solve this error.
> Thanks in advance.
> 


Mime
View raw message