passing an argument to startup.pl
passing an argument to startup.pl
am 14.09.2006 22:58:58 von Geronimo
This is a multi-part message in MIME format.
------=_NextPart_000_0074_01C6D848.FAE00C70
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
PROBLEM:
I need to pass an argument to startup.pl, in order to associate Apache2 =
with a specific version of an app. The app version has a simple =
identifier, say 'dv1'.=20
What I'm trying to do is emulate passing an argument on the command =
line, which will show up in @ARGV, like;
$ /devel/startup.pl dv1
I've tried various things, like quoting the call to startup.pl in =
httpd.conf;
PerlRequire "/devel/startup.pl dv1"
which doesn't work, as PerlRequire sees dv1 as a second argument to =
itself. All the methods I've looked at for setting environment variables =
don't get visibility until the server is up and running, which is fair =
enough.
SOLUTION:=20
None so far, except this workaround
# in http.conf:
# fake addition to @INC
PerlSwitches -I/devel/dv1
PerlRequire "/devel/startup.pl"
# in startup.pl
... pull /devel/dv1 off @INC with a grep
Any suggestions of a more worthy solution would be appreciated.
Thanks,
Gerard
# "Be who you are and say what you feel, because those who mind don't =
matter and those who matter don't mind."
# - Dr. Seuss
------=_NextPart_000_0074_01C6D848.FAE00C70
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
charset=3Diso-8859-1">
PROBLEM:
I need to pass an argument to =
startup.pl, in=20
order to associate Apache2 with =
a specific=20
version of an app. The app version has a simple identifier, say 'dv1'.=20
What I'm trying to do is emulate =
passing an=20
argument on the command line, which will show up in @ARGV, =
like;
$ /devel/startup.pl dv1
I've tried various things, like quoting =
the call to=20
startup.pl in httpd.conf;
PerlRequire "/devel/startup.pl =
dv1"
which doesn't work, as PerlRequire sees =
dv1 as a=20
second argument to itself. All the methods I've looked at for setting=20
environment variables don't get visibility until the server is up and =
running,=20
which is fair enough.
SOLUTION:
None so far, except this =
workaround
# in http.conf:
# fake addition to @INC
PerlSwitches -I/devel/dv1
PerlRequire =
"/devel/startup.pl"
# in startup.pl
.. pull /devel/dv1 off @INC with a=20
grep
Any suggestions of a more worthy =
solution would be=20
appreciated.
Thanks,
Gerard
# "Be who you are and say what you =
feel, because=20
those who mind don't matter and those who matter don't mind."
# =
- Dr.=20
Seuss
------=_NextPart_000_0074_01C6D848.FAE00C70--
Re: passing an argument to startup.pl
am 14.09.2006 23:46:25 von Jeff Nokes
--0-734813493-1158270385=:24360
Content-Type: text/plain; charset=us-ascii
I guess you could try to do something dynamic with blocks in your httpd.conf ...
open(NEW_MODULE, '>Startup.pm');
print NEW_MODULE (
"package Startup;\n" .
"our $arg_1 = 'dv1';
);
then within startup.pl you do ...
use Startup; (or require "Startup.pm")
if($Startup::arg_1 eq 'dv1')
{
#do something ...
}
I've never done anything like this but it should work, in theory (I think :-)
- Jeff
----- Original Message ----
From: Geronimo
To: modperl@perl.apache.org
Sent: Thursday, September 14, 2006 1:58:58 PM
Subject: passing an argument to startup.pl
PROBLEM:
I need to pass an argument to startup.pl, in order to associate Apache2 with a specific version of an app. The app version has a simple identifier, say 'dv1'.
What I'm trying to do is emulate passing an argument on the command line, which will show up in @ARGV, like;
$ /devel/startup.pl dv1
I've tried various things, like quoting the call to startup.pl in httpd.conf;
PerlRequire "/devel/startup.pl dv1"
which doesn't work, as PerlRequire sees dv1 as a second argument to itself. All the methods I've looked at for setting environment variables don't get visibility until the server is up and running, which is fair enough.
SOLUTION:
None so far, except this workaround
# in http.conf:
# fake addition to @INC
PerlSwitches -I/devel/dv1
PerlRequire "/devel/startup.pl"
# in startup.pl
.. pull /devel/dv1 off @INC with a grep
Any suggestions of a more worthy solution would be appreciated.
Thanks,
Gerard
# "Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind."
# - Dr. Seuss
--0-734813493-1158270385=:24360
Content-Type: text/html; charset=us-ascii
I guess you could try to do something dynamic with <Perl> blocks in your httpd.conf ...
<Perl>
open(NEW_MODULE, '>Startup.pm');
print NEW_MODULE (
"package Startup;\n" .
"our $arg_1 = 'dv1';
);
</Perl>
then within startup.pl you do ...
use Startup; (or require "Startup.pm")
if($Startup::arg_1 eq 'dv1')
{
#do something ...
}
I've never done anything like this but it should work, in theory (I think :-)
- Jeff
----- Original Message ----
From: Geronimo
<gerard@clerkin.co.uk>
To: modperl@perl.apache.org
Sent: Thursday, September 14, 2006 1:58:58 PM
Subject: passing an argument to startup.pl
PROBLEM:
I need to pass an argument to startup.pl, in
order to associate Apache2 with a specific
version of an app. The app version has a simple identifier, say 'dv1'.
What I'm trying to do is emulate passing an
argument on the command line, which will show up in @ARGV, like;
$ /devel/startup.pl dv1
I've tried various things, like quoting the call to
startup.pl in httpd.conf;
PerlRequire "/devel/startup.pl dv1"
which doesn't work, as PerlRequire sees dv1 as a
second argument to itself. All the methods I've looked at for setting
environment variables don't get visibility until the server is up and running,
which is fair enough.
SOLUTION:
None so far, except this workaround
# in http.conf:
# fake addition to @INC
PerlSwitches -I/devel/dv1
PerlRequire "/devel/startup.pl"
# in startup.pl
.. pull /devel/dv1 off @INC with a
grep
Any suggestions of a more worthy solution would be
appreciated.
Thanks,
Gerard
# "Be who you are and say what you feel, because
those who mind don't matter and those who matter don't mind."
# - Dr.
Seuss
--0-734813493-1158270385=:24360--
Re: passing an argument to startup.pl
am 14.09.2006 23:58:58 von jonathan vanasco
On Sep 14, 2006, at 4:58 PM, Geronimo wrote:
> PROBLEM:
> I need to pass an argument to startup.pl, in order to associate
> Apache2 with a specific version of an app. The app version has a
> simple identifier, say 'dv1'.
> What I'm trying to do is emulate passing an argument on the command
> line, which will show up in @ARGV, like;
> $ /devel/startup.pl dv1
use $ENV
either set it on the command line, do some fancy stuff with
apachectl's -D , or include multiple apachectl files
or 2/3 all at once! ( just to show how )
apachectl -D dv1 start
httpd.conf
include startup_dv1.pl
include startup.pl
startup_dv1.pl
do some specific dv1 stuff here
$ENV{'myAppServer'}= 'dv1
startup.pl
if ( $ENV{'myAppServer'} eq 'dv1 ) {
etc
}
I personally
make heavy use of -D to handle server versions ( so the same
startup.pl and httpd.conf work on OSX , ubuntu and FreeBSD )
include a per-server version of startup.pl, before including
startup.pl , so i have the right things for the right os
set $env within perl for server specific code
Re: passing an argument to startup.pl - RESOLVED
am 15.09.2006 22:38:05 von Geronimo
This is a multi-part message in MIME format.
------=_NextPart_000_004B_01C6D90F.3A551870
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Many thanks to Jonathan Vanasco and Jeff Noakes for their respective =
solutions to this problem. I've implemented both; Jonathan's on a =
production unix server and Jeff's on a Win32 test box where apache runs =
as a service.
Very helpful.
Best Regards,
Gerard
# "Be who you are and say what you feel, because those who mind don't =
matter and those who matter don't mind."
# - Dr. Seuss
----- Original Message -----=20
From: Geronimo=20
To: modperl@perl.apache.org=20
Sent: Thursday, September 14, 2006 9:58 PM
Subject: passing an argument to startup.pl
PROBLEM:
I need to pass an argument to startup.pl, in order to associate =
Apache2 with a specific version of an app. The app version has a simple =
identifier, say 'dv1'.=20
What I'm trying to do is emulate passing an argument on the command =
line, which will show up in @ARGV, like;
$ /devel/startup.pl dv1
I've tried various things, like quoting the call to startup.pl in =
httpd.conf;
PerlRequire "/devel/startup.pl dv1"
which doesn't work, as PerlRequire sees dv1 as a second argument to =
itself. All the methods I've looked at for setting environment variables =
don't get visibility until the server is up and running, which is fair =
enough.
SOLUTION:=20
None so far, except this workaround
# in http.conf:
# fake addition to @INC
PerlSwitches -I/devel/dv1
PerlRequire "/devel/startup.pl"
# in startup.pl
.. pull /devel/dv1 off @INC with a grep
Any suggestions of a more worthy solution would be appreciated.
Thanks,
Gerard
# "Be who you are and say what you feel, because those who mind don't =
matter and those who matter don't mind."
# - Dr. Seuss
------=_NextPart_000_004B_01C6D90F.3A551870
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
charset=3Diso-8859-1">
Many thanks to Jonathan Vanasco and =
Jeff Noakes for=20
their respective solutions to this problem.
size=3D2>I've=20
implemented both; Jonathan's on a =
production unix=20
server and Jeff's on a Win32 test box where apache runs as a=20
service.
Very helpful.
Best Regards,
Gerard
# "Be who you are and say what you =
feel, because=20
those who mind don't matter and those who matter don't mind."
# =
- Dr.=20
Seuss
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
----- Original Message -----
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black">From:=20
href=3D"mailto:gerard@clerkin.co.uk">Geronimo=20
To:
title=3Dmodperl@perl.apache.org=20
href=3D"mailto:modperl@perl.apache.org">modperl@perl.apache. org =
Sent: Thursday, September 14, =
2006 9:58=20
PM
Subject: passing an argument to =
startup.pl
PROBLEM:
I need to pass an argument to =
startup.pl, in=20
order to associate Apache2 =
with a specific=20
version of an app. The app version has a simple identifier, say 'dv1'. =
What I'm trying to do is emulate =
passing an=20
argument on the command line, which will show up in @ARGV, =
like;
$ /devel/startup.pl dv1
I've tried various things, like =
quoting the call=20
to startup.pl in httpd.conf;
PerlRequire "/devel/startup.pl =
dv1"
which doesn't work, as PerlRequire =
sees dv1 as a=20
second argument to itself. All the methods I've looked at for setting=20
environment variables don't get visibility until the server is up and =
running,=20
which is fair enough.
SOLUTION:
None so far, except this =
workaround
# in http.conf:
# fake addition to @INC
PerlSwitches =
-I/devel/dv1
PerlRequire =
"/devel/startup.pl"
# in startup.pl
.. pull /devel/dv1 off @INC with a=20
grep
Any suggestions of a more worthy =
solution would=20
be appreciated.
Thanks,
Gerard
# "Be who you are and say what you =
feel, because=20
those who mind don't matter and those who matter don't mind."
# =
-=20
Dr. Seuss
size=3D2>
------=_NextPart_000_004B_01C6D90F.3A551870--