Syntactic Confectionery Delight | |
PerlMonks |
Re: Re: Configuration Fileby Excalibor (Pilgrim) |
on Jul 15, 2003 at 08:40 UTC ( [id://274305]=note: print w/replies, xml ) | Need Help?? |
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, --
In Section
Seekers of Perl Wisdom
|
|