I was pretty happy with DBIx::Connect until this Friday when 7 databases on the same host had the exact same connection data.

I had to make 7 new entries in my database configuration file, all the time wondering if AppConfig had some means of defaulting across configurations.

So, I began reading the docs to Resources since I remembered that it supported data inheritance. At the time, the idea did not have much relevance, but after my session of cutting and pasting into my config file, I now knew the value of inheritance of configuration data firsthand!

I was bothered by the following quote from the docs of Resources:

Resources defined in a derived class (like Car) override those specified in a base class. <bothersome> Likewise, resources defined in a container class override those specified in the members.</bothersome> In the above example, a default value for "car.speed" in Car overrides the value of "vehicle.speed" in any Car object, otherwise "car.speed" assumes the value of "vehicle.speed". Same for "car.tire.pressure".

It seems like it should be the other way around: the contained elements should refine the general defaults/expectations of the container class with the information specific to their circumstance. For example: if the front wheels of a car should have a tire pressure 5 more psi than the default, then you would set the default in the container class and then "specialize" it to 5 more psi for the front wheels.

But based on the above docs, the container controls the values of the contained, not vice versa.

Does anyone know why?

Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality.


In reply to should container classes override the value of contained classes (Resources.pm) by princepawn

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.