How to require() a file?
am 27.02.2009 19:28:19 von sf181257
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig695AC3C7222D63745AF3ED1A
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
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=20
/home/stf/public_html/test/arcv/public_html/../common.pl in @INC (@INC=20
contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi=20
/usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi=20
/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi=20
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi=20
/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7=20
/usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5=20
/usr/lib/perl5/site_perl=20
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi=20
/usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi=20
/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi=20
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi=20
/usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7=20
/usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5=20
/usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi=20
/usr/lib/perl5/5.8.8 . /etc/httpd) at=20
/home/stf/public_html/test/arcv/public_html/ticket-list.pl line 13,=20
line 344.\n
How can I require() a file when using Perl in CGI mode? Do I have to=20
modify @INC?
I don't really feel like making it a module, and putting it into Some=20
Well Known Location is something I don't feel like even more. It's just=20
a supporting file that I want to keep together with the rest of the=20
application.
I guess I am using mod_perl:
[Fri Feb 27 16:31:48 2009] [notice] Apache/2.2.6 (Unix) DAV/2 PHP/5.2.4=20
mod_perl/2.0.3 Perl/v5.8.8 configured -- resuming normal operations
Thanks!
STF
==================== =====3D=
==================== =====3D=
==================== =3D
http://eisenbits.homelinux.net/~stf/ . My PGP key fingerprint is:
9D25 3D89 75F1 DF1D F434 25D7 E87F A1B9 B80F 8062
==================== =====3D=
==================== =====3D=
==================== =3D
--------------enig695AC3C7222D63745AF3ED1A
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFJqDDH6H+hubgPgGIRAkVkAJ9Gy9mUGjdwvDfo56GgoOnv2EwnzgCg kzp5
9HZrEY/VNUM04iPYa3O0Xaw=
=+JeZ
-----END PGP SIGNATURE-----
--------------enig695AC3C7222D63745AF3ED1A--
Re: How to require() a file?
am 27.02.2009 19:58:21 von mcapone
This is a multi-part message in MIME format.
--------------080407060104040302040601
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
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.
--------------080407060104040302040601
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
StanisÅaw T. Findeisen wrote:
type="cite">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
class="moz-txt-slash">/home/stf/public_html/test/arcv/public_html
class="moz-txt-tag">/../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
class="moz-txt-tag">/../common.pl
I believe the ../ in there may be what's throwing things off. That
would probably interpolate as
class="moz-txt-tag">
    /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.
--------------080407060104040302040601--
Re: How to require() a file?
am 27.02.2009 20:01:04 von sf181257
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigEB095323E378DE2B013A3666
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Michael A. Capone wrote:
> I believe the ../ in there may be what's throwing things off. That=20
> would probably interpolate as
> /home/stf/public_html/test/arcv/common.pl
>=20
> ... which, unless that is indeed where common.pl is located, would=20
> generate the error you're seeing.
Yes this is where common.pl is located.
It was just a permission problem. :-)
STF
==================== =====3D=
==================== =====3D=
==================== =3D
http://eisenbits.homelinux.net/~stf/ . My PGP key fingerprint is:
9D25 3D89 75F1 DF1D F434 25D7 E87F A1B9 B80F 8062
==================== =====3D=
==================== =====3D=
==================== =3D
--------------enigEB095323E378DE2B013A3666
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFJqDhw6H+hubgPgGIRAi0PAKCgFZFK+CHyDf/7v0JA3t73/yRTlgCd EXvx
CHnqZaCo+zZubLkvJ2fTVcs=
=8VGf
-----END PGP SIGNATURE-----
--------------enigEB095323E378DE2B013A3666--