in reply to Re: object method question
in thread object method question

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!