Well I've just converted all places in httpd.conf where I need to do
interpolation to use here documents and $PerlConfig so consider me a convert.
Quoting "Andreas J. Koenig" <[EMAIL PROTECTED]>:
> >>>>> On Wed, 2 Aug 2006 14:16:00 -0500, [EMAIL PROTECTED] said:
>
> > Can you show me how this can be configured then without using
> $PerlConfig
> > JkWorkerProperty worker.list=myWorker
> > JkWorkerProperty worker.myWorker.port=$workerPort
> > JkWorkerProperty worker.myWorker.host=127.0.0.1
> > JkWorkerProperty worker.myWorker.type=ajp13
> > JkWorkerProperty worker.myWorker.secret=secretword
>
> I think such things can _only_ be done with $PerlConfig. That's why I
> use it everywhere. I only have to write things as documented in the
> apache docs and need not understand the subtleties of the other
> variables supported by Apache*::PerlSections
>
> > If I try
>
> > push @JkWorkerProperty, "worker.list=myWorker";
>
> > it doesn't setup right.
>
> Not surprising for me.
>
> > This is rather unique because it's valid apache syntax but not that
> common
>
> I cannot understand your sentence because I see no valid apache syntax here.
>
> > I'm now using $PerlConfig to work around this but I'd like to know if
> there
> > was another way.
>
> > This is how I'm
>
> > <Perl>
>
> > my $logDir = $ENV{'X_LOGDIR'};
> > my $workerPort = $ENV{'X_WORKER_PORT'};
>
> > $PerlConfig .=<<END;
> > JkWorkerProperty worker.list=myWorker
> > JkWorkerProperty worker.myWorker.port=$workerPort
> > JkWorkerProperty worker.myWorker.host=127.0.0.1
> > JkWorkerProperty worker.myWorker.type=ajp13
> > JkWorkerProperty worker.myWorker.secret=secretword
> > JkLogFile $logDir/mod_jk.log
> > JkLogLevel debug
> > JkShmFile $logDir/jk-runtime-status
> > END
>
> > Please note in order to do the $ENV above I have to have this.
>
> > <Perl>
> > # repopulate %ENV
>
> > for (`env`) {
> > next unless /^X_/;
> > /(.*)=(.*)/;
> > $ENV{$1} = $2;
> > push @PassEnv, $1;
> > #print "$_\n";
> > }
>
> > this essentially puts back what mod_perl took out of %ENV upon startup
> and it
> > seems to remain in %ENV across all Perl Sections. I have not seen any
> example
> > where PassEnv can be used instead of the above approach.
>
> > ---
>
> >
>
http://perl.apache.org/docs/1.0/guide/config.html#Apache_Configuration_in_Perl
> >
>
http://perl.apache.org/docs/1.0/guide/porting.html#Passing_ENV_variables_to_CGI
>
> > "The Perl %ENV is cleared during startup, but the C environment is left
> intact.
> > With a combo of forking `env` and <Perl> sections you can do even do
> wildcards
> > matching. For example, this passes all environment variables that begin
> with
> > the letter H:"
>
> > ---
>
> > What is the correct way to define a variable that can hold state that
> will
> > survive across Perl Sections but yet won't end up in the httpd
> configuration?
> > Do I have to declare a my and use $ENV everytime I need to refer to
> these
> > variables in a Perl Section?
>
> If the Perl section are in the same file, I'd use lexical variables
> because they are ignored by the mod_perl mechanism. If they are in
> different files, pick names that are unlikely to be interpreted by
> perl or mod_perl. Maybe use underscores or so. Definitely no need to
> use %ENV, $robert_at_elastica::foo::bar works as well and doesn't
> trigger perl's environment handling.
>
> > Unfortunately with the mod_perl setup I'm using I cannot use
>
> > Apache::PerlSections->dump so it's hard to verify things.
>
> > Quoting Robert Nicholson <[EMAIL PROTECTED]>:
>
> >> So can you or somebody else post a complete httpd.conf that makes use
> >> of $PerlConfig then?
> >>
> >> On Aug 1, 2006, at 2:24 PM, Andreas J. Koenig wrote:
> >>
> >> >>>>>> On Tue, 1 Aug 2006 13:56:31 -0500, [EMAIL PROTECTED] said:
> >> >
> >> >> That resulted in errors at least in my case.
> >> >
> >> > You did read that I said you need SVN recent for apache2?
> >> >
> >> > --
> >> > andreas
> >>
>
>
>
>
> > ----------------------------------------------------------------
> > This message was sent using IMP, the Internet Messaging Program.
>
>
>
> --
> andreas
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.