in reply to Re: How can I avoid creating two instances of the same object
in thread How can I avoid creating two instances of the same object

This is the first time I've looked at that moudule, but I'm not sure that that's what I'm looking for. Would that allow me to call methods from different subclasses, to be used on one object. I'll write a little sudo code. client will be a method of Company and user will be a method of User.
use Company; use User; my $dbh = Company->new(); my $client_info = $dbh->client(); my $user_info = $dbh->user();
Keep in mind that Company has gained it's new method by subclassing a parent class. I don't even know if this is possible, but it sure would be nice!

Replies are listed 'Best First'.
Re^3: How can I avoid creating two instances of the same object
by Fletch (Bishop) on Mar 02, 2006 at 13:55 UTC

    Erm, you've just muddied the waters a good bit. Unless Company is a subclass of User why would you be able to call a method from the later on the former?

    At any rate, it looks like you might be more interested in Class::DBI (which I should have mentioned in the first place). Define your DBI connection parameters in a base class and then all of your table classes inherit from that and will do the right thing with regards to sharing a database handle.