Someone once asked me to help them learn the right way to fish. My answer to that person was you learn the way to fish that is right for you and the kind of fish you want to catch.

Same is very true in my humble opinion about your question. There are many right ways to do it.

First off I'm a big fan of using XML::Simple to parse in an XML file that I have stored on the system that the script is going to run on someplace predictable. Just so happens that with XML::Simple this can be a no brainer because the default behavior for the method XMLin, one of the methods the module defines, is to look for a file with the same base name as the script you are running, in the directory the script is running from with the extension ".xml". The module also provides for pathing behavior as well.

The module you show in your example is a good start. One trick I've used is to use $0, strip off any extensions to it and use that as a key into my XML file for where the application data lives.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

In reply to Re: Application-wide configuration by blue_cowdawg
in thread Application-wide configuration by akho

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.