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 = <


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:irective::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?

my $config = do 'startup.pl';
#parse config into @vhosts
foreach my $vhost (@vhosts) {

Or should I use something like:

PerlOpenLogsHandler startup.pl

Help appreciated

__________________________________________________ ______________________

Clinton Gormley clinton@traveljury.com

www.TravelJury.com - For travellers, By travellers