Re: how to require() a file?
[email protected] ("Stanisław T. Findeisen") Wed, 04 Mar 2009 10:31:07 +0100 <[email protected]>
| Newsgroups | perl.beginners.cgi |
|---|---|
| Message-ID | <[email protected]> |
Gunnar Hjalmarsson wrote:
> 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
>
> <snip>
>
>> /usr/lib/perl5/5.8.8 . /etc/httpd) at
> -----------------------^
>
>> How can I require() a file when using Perl in CGI mode? Do I have to
>> modify @INC?
>
> Based on your reply (to an answer that I not saw) it seems like giving
> the web server read access to common.pl solved your problem. Together
> with the fact that the current directory is included in @INC, it
> indicates that you are not running the script under mod_perl.
>
>> I guess I am using mod_perl:
>
> Guess?? You really, really ought to know! What happens if you add this
> line to the script:
>
> print "Not mod_perl\n" unless $ENV{MOD_PERL};
Nothing is being printed. :-) I am having taint mode commented out in my
/etc/httpd/conf.d/perl.conf file:
# Uncomment this line to enable taint checking globally. When Perl is
# running in taint mode various checks are performed to reduce the
# risk of insecure data being passed to a subshell or being used to
# modify the filesystem. Unfortunately many Perl modules are not
# taint-safe, so you should exercise care before enabling it on a
# production server.
#
#PerlSwitches -T
and that's why I am having . included in @INC, I guess.
STF
=======================================================================
http://eisenbits.homelinux.net/~stf/ . My PGP key fingerprint is:
9D25 3D89 75F1 DF1D F434 25D7 E87F A1B9 B80F 8062
=======================================================================
signature.asc
(application/pgp-signature, 251 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFJrkpb6H+hubgPgGIRAsbJAKC+N9Dgx0lz6K+HQFmN5daQtbcK3ACguwt9 wZDht4CC10rgFSe+ibvlCB0= =Zi9v -----END PGP SIGNATURE-----