Apache-Test automagically assigns port numbers to vhost sections, e.g.:

<VirtualHost myhost>
PerlSetVar foo bar
</VirtualHost>

is expanded to:

Listen 0.0.0.0:8530
<VirtualHost _default_:8530>
    ServerName lapin.stason.org:8530
    PerlSetVar foo bar
</VirtualHost>

But what if I need to use <Perl> inside Vhost, since some values require a code to be run? If I do:

<Perl>
my $val = get_val();
$VirtualHost{myhost} = {
   PerlSetVar => ["foo", $bar],
}
</Perl>

A-T won't know to expand it. On the other hand, doing:

<VirtualHost myhost>
<Perl>
  my $val = get_val();
  $PerlSetVar = ["foo", $bar];
</Perl>
/VirtualHost>

is not putting the config into the right vhost (it goes to the top-level config.

The only tricky way I've managed to enjoy the both worlds, is using add_config:

<Perl>
  use Apache2::ServerUtil ();
  my $val = get_val();
  Apache2::ServerUtil->server->add_config([split /\n/, <<EOI]);
# t/limit/maxx_conn.t
<VirtualHost myhost>
    PerlSetVar foo $var
</VirtualHost>
EOI

</Perl>

I don't see how we can make A-T aware of <Perl> in any other ways. Ideas?


--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://mailchannels.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to