http://www.perlmonks.org?node_id=585628


in reply to Config Files in Perl

Some thoughts:

Replies are listed 'Best First'.
Re^2: Config Files in Perl
by blazar (Canon) on Nov 22, 2006 at 22:34 UTC
    I prefer using XML-based config files and using, say, XML::Simple to parse the file. It is just about as easy as parsing name=value files.

    I sort-of second that, except that I'd use YAML. Even if one doesn't know it (I don't really), it should be easy enough to look at some samples and imitate them, or instruct one about how to do so in a few words. It's more human readable and writable IMHO.

      I agree, YAML is great. Loading and saving a config is dead easy, and the config is very human read/writable.
Re^2: Config Files in Perl
by chromatic (Archbishop) on Nov 22, 2006 at 22:26 UTC
    ... why not just go with XML?

    Because humans might have to modify the configuration file?

      They might. OTOH it might all be done by software. That wasn't specified.

      Now, I agree that XML is not beautiful, but so many people who might edit config files probably are at least somwehat used to HTML, and even vim knows XML highlighting. I do not think it is a problem unless the config file designer goes wild...

        You should be programming away from bad/worst case scenario not around assumptions about the end-user.

        XML sure is terse and unweildy, no matter whether a human is used to it or not, the chances of things going wrong as a result of a "configuration error" when manually editing XML are high.

        However, in the day and age of RAD, it's wise and definitely feasible to have a UI manage and maintain the configuration file(s), XML or otherwise.