I disagree.
There are plenty of legitimate reasons to want to have
more complex data structures in a configuration than
just a simple hash.
Also while there are plenty of configuration modules on
CPAN, I haven't seen any that I like very much. Here are
the main capabilities that I want out of a configuration
solution:
- Be able to have any kind of data structure into
the configuration.
- Be able to have a search path with selective
overriding of configuration information. For instance
the development and production configurations should be
as similar as possible, with only a few key values being
overridden.
- Be able to selectively tie together the
configurations of separate modules which should share some
common information based on your environment.
- Have checks so that if someone is trying to access
a variable from the configuration that isn't there, you
can catch it and fix.
On these criteria, most of the CPAN configuration modules
score 0/4. Just using raw Perl as a configuration file
scores 2/4. A simple bit of code that searches a
configuration path and
does every file it finds there
with a specific name scores 3/4. And if you know what
you are doing, it is possible to create a simple
configuration module that adds the export checks.
Now those wants are not everyone's. Everyone wants to
get different things from a configuration module (which is
one reason why there are so many configuration modules out
there). But I claim that my list is not an unreasonable
set of wants for a Perl programmer to have, and if you
have them then pure Perl is a perfectly reasonable kind of
configuration file to use.
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.