Hi,

Back in my younger and less wise days of Perling, I wrote an application that ran on many different instances of data and depended upon a configuration file to know how to act for each instance of the data. I started out with something much like you have demonstrated above, but with requested features and necessary additions I found a need to represent arrays, hashes and compound data structures in my now very complex configuration file.

These configuration files continue to grow in size and complexity to this day to they point where they can be 20k+ in size and I have an 18 page document describing how to configure it. Not only that, but it is very easy to break and if you do so the entire application stops working (for that instance of the data). (eval catches it, but the data is needed to run, so it just stops.)

I bring this up in such detail because I did what I thought at the time to be a wise action and kick myself on a daily basis for my actions now. I hope you are not setting yourself up for the same situation that I find myself in today. I face a monumental task of rewriting a large application and re-educating many users.

If today I was starting over again with my current knowledge I would implement the entire application based on configuration files written in XML. The XML::Simple module excels at performing such tasks. The added advantage is that such files are very eye-ball friendly. So I entreat you to consider this module or some other alternative our wonderful fellow monks can provide.

Best of luck,
{NULE}

-- http://www.nule.org

Update:
Thanks for the information, merlyn. I will be sure to eval{use Data::Denter} for my own application. I may be inclined towards XML just because it is so cross-platform, cross-language, etc.


In reply to Re: easy config file by {NULE}
in thread easy config file by LiTinOveWeedle

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.