I am trying to configure virtual hosts dynamically in mod_perl2.
I have a startup file which sets up an 'application' based on my own
framework. Part of that inflation creates a number of virtual hosts.
I have been trying the following:
-------------------------
In httpd.conf:
PerlConfigRequire /path/startup.pl
-------------------------
In startup.pl:
....
my $config = <<VHOST
<VirtualHost 127.0.0.1>
</VirtualHost>
VHOST
Apache2::Server->server->add_config([split /\n/ $config]);
-------------------------
When I tried with PerlRequire or PerlPostConfigRequire, adding the
virtual host would give me a segfault.
With PerlConfigRequire, it runs fine, but if I do:
@vhosts = Apache2::Directive::conftree->lookup("VirtualHost")
it doesn't find any virtual hosts.
I want to keep the line in httpd.conf as simple as possible. How should
I go about doing this?
I could use PerlSections, but how?
<Perl>
my $config = do 'startup.pl';
#parse config into @vhosts
foreach my $vhost (@vhosts) {
$VirtualHost{$vhost}=>$config->{$vhost}
}
</Perl>
Or should I use something like:
<Perl handler="startup.pl">
</Perl>
Or:
PerlOpenLogsHandler startup.pl
Help appreciated
________________________________________________________________________
Clinton Gormley [EMAIL PROTECTED]
www.TravelJury.com - For travellers, By travellers