>> No wonder Nathan Wiger on Jun 27 said that,
NW] Hi all-
NW]
NW] I've written a module that can parse the Apache httpd.conf config file
NW] (and in fact any Apache-like config file). It will take a set of
NW] directive like:
NW]
NW] ServerName www.mydomain.com
NW] UseCanonicalName Off
NW]
NW] And parse it case-insensitively, returning a ref to a hash:
NW]
NW] my $ac = new Apache::Config;
NW] my $conf = $ac->readconf($configfile);
NW] print $conf->{servername}; # = "www.mydomain.com";
NW] print $conf->{usecanonicalname}; # = 0 (not undef so can test
NW] # for defined() still)
NW]
NW] I am also finishing up the ability to parse within contexts, such as
NW] <Directory> and <Location>. I am still unsure of the interface, I have
NW] two ideas:
NW]
NW] 1. multi-level hash, i.e.
NW] $conf->{"directory /"}->{sethandler}
NW]
NW] 2. individual functions, i.e.
NW] $conf->directory("/")->{sethandler}
NW]
NW] If anyone has any input, I'm all ears. Right now I'm leaning towards the
NW] second one, if I can get it working. The first one is really flexible
NW] and easy, the problem is that it's difficult to search. The second one
NW] helps with this issue, but the downside is that new functions have to be
NW] added if new Apache contexts are defined. I'm trying to play some tricks
NW] with the AutoLoader ala Shell to get new functions defined on the fly.
NW] If anyone has good ideas for a better interface, I'd also like to hear
NW] them.
NW]
NW] In any case, I have several questions:
NW]
NW] 1. Does a module like this exist anywhere? I saw Doug's
NW] Apache::httpd_conf, but this only takes care of writing
NW] a very minimal config file. I looked thru all the
NW] Apache:: modules but didn't see one.
You may want to take a look at AppConfig module. It does provide
generic capability to parse various kinds of config file. But I'll
be a happy user to have more spesific Apache related in this regard.
NW]
NW] 2. Is the name Apache::Config a good name for this module?
NW] It seems like the obvious choice to me, and doesn't
NW] look like it's taken. I've also played around with
NW] Apache::ConfigFile and Apache::ReadConf, either of
NW] which I'm open to as well (or other suggestions?).
Apache::Config will be sufficient, IMHO, as later someone might
write another module, say Apache::Config::Deploy, that syncronize
the configuration of some httpds across some networks.
[snip]
san
--
trabasLabs * [EMAIL PROTECTED] * http://www.trabas.com
Zero Point * [EMAIL PROTECTED] * http://www.zp.f2s.com
------------------------------------------------------
....bahkan mahasiswa yang memperjuangkan reformasi
pun masih menempatkan wanita pada posisi inferior
--Sudjiwo Tejo 14/12/1998
tentang kiriman ayam betina kepada Jaksa Agung