You misunderstand me. You need one subclass per application, and one directory tree with all your config data.

Again, you're making assumptions that may make ense to you as the author and the user ... but if you want this to be generally reusable for other people (which is i'm assuming your reason for posting it as an RFC and ultimatley to CPAN) you have to acknowledge that not everyone wants to do this ... there are *lots* of good reasons why an application may want o use multiple unrelated directories to store configuration.

even if it turely is one per applcation, why should i rewrite the same 3 line module over and over for every application with the only difference being the directory name?

Is that really so difficult?

No, but it's cumbersome, and limiting -- not things that generally make a module reusable. Loading data only once at startup may make sense to you, but i may want to make it possible to reload my configs on demand ... i can't do that with your module as is. Loading the data in a way that makes it globally accessible may make sense in some applications, but in other applications it may make sense to have the config data more protected, and only pass it to the methods that need it.

For the use case you seem to want to make really easy (parse config files once on startup, make available globally) your approach actually seems like requires the application writer to write a lot more code then if you just returned an object and letting them assign to a global variable...

use Burro:Config; $main::config = Burro::Config->parse('/my/conf/dir');

Two lines. Done. No custom subclass per config directory, no importing the custom subclass in all the other modules that need to know about the config -- every piece of code that you suggest needs to "use My::Config" before calling your C function can now just know to call $main::config->C instead.


In reply to Re^5: RFC: A YAML config module to be posted to CPAN by hossman
in thread RFC: A YAML config module to be posted to CPAN by clinton

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.