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 <[EMAIL PROTECTED]>
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
 

Reply via email to