I use that method too in a different project, but I'd really like the hashes and friends to be named the same in the Config module and the config file, that way, we don't get confused.

I cannot stress enough the potential danger in this. Besides the obvious fact that someone could break security on the owning UID for that file and insert malicious code, there is another, more dire possible effect: you may have to maintain this code.

What you are currently doing is very fragile, almost completely unscalable, and quite unreadable to someone looking at the code without the benefit of having been there from the beginning. It is far better to develop a regular habit of using a configuration file that is not itself code. Not only does that make for fewer maintenance headaches, it opens the possibility of sharing config resources between applications, moving parts of the application to more modular designs, and a general sense of ease in the world at large.

If you are not fond of the idea of writing Yet Another Configuration Parser, I recommend starting with examination of AppConfig, Config::General, ParsePlainConfig and XML::Config. Not surprisingly, given Perl's strong text-manipulation abilities, there has been quite a lot of work done in terms of flexible configuration tools.

--rjray


In reply to Re: Re: Re: = for lists and hashes? by rjray
in thread = for lists and hashes? by skazat

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.