On Mon, 2 Jul 2001, Gareth Hughes wrote:

> Hi All
>
> I've successfully configured Apache on Win2k. One of the sites I host uses a
> lot of perl so mod_perl was an obvious addition.
> I know nothing about perl but I'm pretty sure mod_perl is installed and
> running correctly except for being able to reference the correct
> directories. When I access a .pl page I get a 500 internal server error
> returned and the error log shows this:
>
> [Sat Jun 30 15:30:08 2001] [error] Can't locate HTMLfile.pm in @INC (@INC
> contains: .. powershift D:/Perl/lib D:/Perl/site/lib . c:/apache
> group/apache/ c:/apache group/apache/lib/perl) at
> d:/mmwebs/ps/scripts/powershift/veh_sup/approved-vehicles.pl line 31.
> BEGIN failed--compilation aborted at
> d:/mmwebs/ps/scripts/powershift/veh_sup/approved-vehicles.pl line 31.
>
> I've added the module and directory directives in the httpd.conf file and if
> I move the HTMLfile.pm (and a bunch of other .pm files) into
> D:/Perl/site/lib the scripts run correctly. Unfortunately the scripts
> eventually reference other files that can longer be found because the .pm
> files have moved. Also, moving the files is far from ideal for ftp access
> etc.
>
> Shouldn't the scripts be looking in the directory they were run from as they
> did before mod_perl? Does anyone know if this is a mod_perl configuration
> issue or do the perl scripts need some additions to be mod_perl compatible?

mod_perl loads the scripts up into subroutines for execution.  Thus, Perl
is not running them the way they would normally get run, and things like
present working directory might not behave the way you expect.

To add to @INC, you can either use "PerlSetEnv PERL5LIB /whatever" to
httpd.conf, or you can use a startup script (canonically startup.pl) and
include "use lib '/whatever';" therein.

Best,
Jeffrey Baker

  • @INC? Gareth Hughes
    • Jeffrey W. Baker

Reply via email to