Hi all,
However, what I need to be able to do is let someone
have a running mod_perl 2 setup and dynamically "pull in" the above
information from an external file or add that information via Perl (in
other words, I don't want to touch the default httpd.conf file). How
the heck do I do that?
Since I'm the one who's asked Curtis to look into this, let me see if
I can elaborate a little.
What we have is a complex application that needs to do quite a bit of
configuration (set up an access handler, a cleanup handler, a
response handler, allow the default handler for images, etc., etc.,
ad nauseum). When users install it, we don't want them to have to add
a tone of stuff to their httpd.conf just to get all of it going. What
we'd rather have is something like this:
<Location /myapp>
SetHandler perl-script
PerlPostConfigHandler MyApp::Apache2::config
</Location>
The idea is that MyApp::Apache2::config() would figure out that it
was in a Location context with a value of /myapp, and then configure
its handlers relative to that location. The result would be the
equivalent of:
<Location /myapp>
SetHandler perl-script
PerlResponseHandler MyApp::Apache2
PerlAuthenHandler MyApp::Apache2::authen
PerlCleanupHandler MyApp::Apache2::cleanup
</Location>
# REST
<Location /myapp/rest>
SetHandler perl-script
PerlResponseHandler MyApp::Apache2::rest
</Location>
# Static files:
<Location /myapp/ui>
SetHandler default-handler
</Location>
Only dynamically configured. The context could be either a Location
directive for an existing host name, or a virtual host directive, so
that the application would then run in that entire domain.
Now, I've done something similar to this for mod_perl1 in Bricolage.
There, the entirety of the httpd.conf configuration that the user has
to do is this:
PerlPassEnv BRICOLAGE_ROOT
PerlModule Bric::App::ApacheConfig
Yes, that's it. Bric::App::ApacheConfig pulls in virtual host
information from its own configuration file, and then builds up all
of the configuration it needs for that host by adding literal
httpd.conf directives to $Apache::ReadConfig::PerlConfig. That works,
but I'd like to do away with the requirement of a dedicated host, and
I'd like to do it all in mod_perl2 at server startup time.
Does that make things clearer? Is there an equivalent to
$Apache::ReadConfig::PerlConfig in mod_perl2, perhaps? Or better yet,
is there now an API for dynamically configuring Apache from mod_perl2?
Thanks,
David