Startup.perl - There has to be a better way

Hi,

I'm running Apache 2 with mod perl, and every time a create a new
directory for perl software I have to add an entry into the
startup.perl file. The reason why is when I web to the new directory I
always get path not found in INC.

For Example
Webbing to www.testdomain.com has a base path of /www/domains/
testdomain. Therefor I put the base path into the startup.perl file.

If however I add another directory www.testdomain.com/newdir that has
the path /www/domains/testdomain/newdir, I must also add this path to
the startup.perl file.

It seems to me that apache/mod_perl does not have it's current path
"." as part of it's include list.

Is there a better way to do this?

Thanks,
Blaine
Blaine [ Fr, 05 Oktober 2007 20:26 ] [ ID #1837392 ]

Re: Startup.perl - There has to be a better way

Blaine & Alexis wrote:
> Hi,
>
> I'm running Apache 2 with mod perl, and every time a create a new
> directory for perl software I have to add an entry into the
> startup.perl file. The reason why is when I web to the new directory I
> always get path not found in INC.
>
> For Example
> Webbing to www.testdomain.com has a base path of /www/domains/
> testdomain. Therefor I put the base path into the startup.perl file.
>
> If however I add another directory www.testdomain.com/newdir that has
> the path /www/domains/testdomain/newdir, I must also add this path to
> the startup.perl file.
>
> It seems to me that apache/mod_perl does not have it's current path
> "." as part of it's include list.
>
> Is there a better way to do this?

A couple of ideas:

1) to do what you describe above, put this (untested) in startup.pl:
eval 'use lib qw(.)';
This will add . to [at] INC.

2) put your modules in one place and add that location to [at] INC. Use
ScriptAlias for scripts. There is no need for your scripts/modules to
live under the web root.

HTH,
Jim
Jim Hayter [ Fr, 05 Oktober 2007 21:25 ] [ ID #1837393 ]

Re: Startup.perl - There has to be a better way

"Blaine & Alexis" <blaine [at] worldweb.com> schreef in bericht
news:1191608760.051278.140140 [at] k79g2000hse.googlegroups.com.. .
> I'm running Apache 2 with mod perl, and every time a create a new
> directory for perl software I have to add an entry into the
> startup.perl file. The reason why is when I web to the new directory I
> always get path not found in INC.
>
> For Example
> Webbing to www.testdomain.com has a base path of /www/domains/
> testdomain. Therefor I put the base path into the startup.perl file.
>
> If however I add another directory www.testdomain.com/newdir that has
> the path /www/domains/testdomain/newdir, I must also add this path to
> the startup.perl file.
>
> It seems to me that apache/mod_perl does not have it's current path
> "." as part of it's include list.
>
When using mod_perl the current path -rather the current working directory-
is set at start time of the apache2.
Traditional CGImode sets current working directory to the folder homing the
current script.

Good readings starts at
http://www.gossamer-threads.com/lists/modperl/announce/81511
http://perl.apache.org/docs/2.0/api/ModPerl/RegistryPrefork. html
http://perl.apache.org/docs/2.0/user/porting/compat.html#C_A pache__Registry___C_Apache__PerlRun__and_Friends



HansH
HansH [ Sa, 06 Oktober 2007 02:30 ] [ ID #1838098 ]
Webserver » alt.apache.configuration » Startup.perl - There has to be a better way

Vorheriges Thema: HELP: Apache 2 / Tomcat 6 / mod_jk / Windows XP
Nächstes Thema: Conditional alias?