Since discovering Config::Simple a couple of years ago, I have found it useful for more projects than not, including on my most recent application. For this one, though, I'm finding that I'd like to set up a default configuration for each client with one configuration file at /etc/app_name/client_name/app_name.ini, with each job specific instance set up for a client inheriting most of its configuration from there, but over-riding those parameters which are specific to a particular instance, out of its own file at: /etc/app_name/client_name/app_name_job_id.ini. Perhaps providing for multiple levels of inheritance would make sense as well: the server's base installation of the application being accessible at: /etc/app_name/app_name.ini

Is there some elegant, intuitive and simple way to accomplish this task? Am I talking about writing a whole new module: Config::Simple::Inherit to get the job done? Are there other tools out there better suited for this task (which hopefully won't require major surgery on an application which has recently been put into service)?

Any and all advice is appreciated.

-- Hugh Esco

UPDATE:

Man this turned out to be far easier than I feared it might be, at least to accomodate my simple needs. The results are now published on CPAN, as Config::Simple::Inherit. Along the way I learned some more about how absolutely elegant Sherzod B. Ruzmetov's work is. Mr. Ruzmetov: If you're out there and you see any value in this and would like to pick up this new ->inherit() method and include it in core, I certainly feel no need to get territorial about who gets to maintain those 20 or 30 lines of code and its associated documentation. Its available here if you want it: Config-Simple-Inherit-0.03.tar.gz

-- Hugh

if( $lal && $lol ) { $life++; }

In reply to Job specific Configuration, Inherit from Client Configuration by hesco

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.