I'm looking for suggestions/methods/idioms for reading and editing configuration files.
Specifically, I've got a CGI application that read and writes Bind 8.x/9.x named.conf files. I've got a parser mostly written for reading the named.conf file. I can write out a new named.conf file just fine *if* I don't mind blowing away any comments or hand formatting of the file.
I've occasionally seen programs that will read and edit configuration files while making at least some effort to preserve comments and hand edits of the file. I'd love to be able to do that, but I'm pretty much at a loss for where to begin.
Do any monks have any suggestions? Any Perl modules or scripts out there that are good examples of doing this kind of thing?