in reply to question on OO design and object composition
What I did was all my Objects that talk to the database, inherit from one module. That module has an 'import' method( that gets called automatically), where it will attempt to create a database handle if one does not already exists. Then I share the database handle with a dbh() method from the base class.
So this allows only my objects to have just one dbh(). without having to pass a $dbh around.
|
|---|