Thanks very much for the information. I'll have to take a moment to think about it all; you're absolutely right about the time/work/effort ratio, but you've provided me with plenty of food for thought.

As far as your question regarding why I need the '$foo->{_dbh}->dbq' behavior rather than the more straight forward '$foo->dbq'. This is all due to some refactoring of old code that's in really ugly shape with some newer stuff that's better designed. A transition phase, we're going to have alot of the old stuff and new stuff forced to work together.

To keep a very long story short, that '_dbh' needs to get handed around, from class to class - and alot of the old code expects a 'dbq' method attached to it. I specifically would prefer to pass just the '_dbh' object around, rather than the whole '$foo' object ( which'll contain way too much extraneous stuff, unrelated and unwanted by the various recipient class's ).

Not only that, but ( actually, more importantly ) I've found that I tend to want to do similar things when I'm designing my libraries; and it's something I've simply never been able to implement.

I do plenty of of base classing and super classing and whatnot, but I'd really like to better understand how to insert methods into existing objects.

Thanks again!


In reply to Re^2: object method question by Zarathustra
in thread object method question by Zarathustra

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.