{ yes, I saw the chapter in Stas Bekman's book, that's not exactly
what I discuss }
So, there is some mod_perl application. It has a lot of configurable
elements - from urls being used to constants predefining contents of
different drop-down boxes.
Currently the config information is spread between:
- apache config file included to httpd.conf (let's call it myapp.conf),
where different urls and directories are both mapped to handlers
and PerlSetVar'ed so the application can use them when needed,
log formats are defined etc
- separated application module (let's call it MyConfig.pm), where
the things like lookup contents, default field values, customizable
validation criteria or database passwords are kept
I would like to integrate those two.
After some initial consideration I found, that moving config from
MyConfig.pm to myapp.conf does not seem to be reasonable. Imagine
PerlSetVar'ing arrays and hashes which can refer one to another...
Currently I think about the opposite: putting everything configurable
and writing apache config in the style like:
<Perl>
use MyConfig.pm;
$PerlRequire = $MyConfig::InstallDir . '/startup.pl';
$PerlConfig .= <<"ENDCONF";
<Location $MyConfig::SomeUrl>
$MyConfig::accessSettings
SetHandler perl-script
PerlHandler myapp::Handler::Some
<Location>
<Location $MyConfig::OtherUrl>
$MyConfig::accessSettings
SetHandler perl-script
PerlHandler myapp::Handler::Other
<Location>
ENDCONF
if($MyConfig::Debug) {
$LogLevel = 'debug';
$PerlConfig .= "PerlWarn On\n";
} else {
$LogLevel = 'warn';
}
</Perl>
(and more, and more, the above is just a sample to show what I am
thinking about, in fact most of the apache config would be done this
way)
The questions are:
1) As I checked, it seems that such a config would more-or-less
work. But I am a bit afraid of the restart semantics. How can
apache behave when graceful-ed or restart-ed having such a
configuration? Would it be same or different when mod_perl is
DSO'ed and when is statically linked?
2) I found that some Set*Handler directives are processed differently
when specified in myapp.conf and when specified in perl with
Apache->push_handlers (in particular the RestartHandler specified
with push_handlers was not executed while restart although it was
called on startup). Should I be afraid of anything similar after
following such a config change?
3) Do you think that this is the good/bad idea from any other reasons?