perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael A. Capone" <mcap...@cablewholesale.com>
Subject Re: How to require() a file?
Date Fri, 27 Feb 2009 18:58:21 GMT
Stanisław T. Findeisen wrote:
> I am trying to require() a file using its absolute name. In command 
> line mode everything works fine, but not in Apache: [Fri Feb 27 
> 17:45:07 2009] [error] Can't locate 
> /home/stf/public_html/test/arcv/public_html/../common.pl in @INC (@INC 
> contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
>
> How can I require() a file when using Perl in CGI mode? Do I have to 
> modify @INC?
>
> I don't really feel like making it a module, and putting it into Some 
> Well Known Location is something I don't feel like even more. It's 
> just a supporting file that I want to keep together with the rest of 
> the application.
>

/home/stf/public_html/test/arcv/public_html/../common.pl

I believe the ../ in there may be what's throwing things off.  That 
would probably interpolate as
     /home/stf/public_html/test/arcv/common.pl

... which, unless that is indeed where common.pl is located, would 
generate the error you're seeing.

To answer your question, yes, you can absolutely do a require 
"/full/path/to/file.pl" just like that without modifying @INC.

Mime
View raw message