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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.