In addition to some of the other recommendations here, I thought I'd mention Config::ApacheFormat.

This let's you create your own configuration files that work much like Apache's: you can have global defaults that can be over-ridden in particular locations. If you're working on something web-oriented, this can be a good choice -- why not use something that's going to be familiar to people working on the project?

And in general, I think that's the right way to decide the issue: "consider your audience". For example, I would not introduce XML into a project that wasn't already using it for some reason. On the other hand, YAML seems to map pretty well onto the brains of perl programmers, so if the users of your config files are going to be other programmers, than YAML is a good choice...

But if you're targeting Joe Luser, then you might want something even simpler... though ultimately you're probably going to need to provide some graphical front-end to munge the config file, so machine-readability is even more important -- and that rules out using raw perl code in your config: it's easy for perl to execute, but too hard to parse with another program.


In reply to Re: Config Files in Perl by doom
in thread Config Files in Perl by narashima

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.