Hi there,

I deeply dislike XML for configuration files. Unless your configuration data is extremely complicated, with deeply nested environments, you don't need XML at all; and if so, why are you using such a complex configuration anyway?

A simple win INI style config file is powerful enough to give a lot of structure to a config file, and still easily human readable and editable (see Chris Winters' 'Why I love INI files', his lightning talk this year at YAPC) .

I'm with legLess that YAML is a great option for configuration files.

A different approach that I have successfully used in the past is having a flat key: value(s) file, and provide a module (called Foo::RC.pm) to give it structure by the means of functions (get_router_data(), get_groups_data(), etc...). This has the added advantage of putting all the code (open file, chomp, split, etc...) in one, authoritative place, well documented and maintained, and the ability to merge different configuration files/formats if your system is complex enough that any subsystem just needs a special format for itself. It also makes it more robust before ill-formed config files (all sanity check again performed in just one place) and easily extendable.

As a project meets new requirements during it's development/life time, as it's bound to happen, anyway, your DTD would have to be enhanced to reflect the new functionality, this justs ask for a lot of front-desk thinking about a design you don't yet know. I don't like it at all.

best regards,

--
our $Perl6 is Fantastic;


In reply to Re: Re: Configuration File by Excalibor
in thread Configuration File by crackotter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.