Startup.perl - There has to be a better way
am 05.10.2007 20:26:00 von Blaine
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
Re: Startup.perl - There has to be a better way
am 05.10.2007 21:25:59 von Jim Hayter
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 @INC.
2) put your modules in one place and add that location to @INC. Use
ScriptAlias for scripts. There is no need for your scripts/modules to
live under the web root.
HTH,
Jim
Re: Startup.perl - There has to be a better way
am 06.10.2007 02:30:05 von HansH
"Blaine & Alexis" schreef in bericht
news:1191608760.051278.140140@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