I would second the Singleton approach suggested by others - the dbh isn't really an attribute of your objects, your just stashing it to pass around. You might as well provide a global point of access for objects if and when they need it.
It would also give you a logical place to put other generic DB related code, and could be quite easily integrated with your DBIx::Handy module:
package DBIx::Handy; my $dbh = undef; sub get_instance { my $class = shift; if($dbh == undef){ $dbh = ... } return $dbh; } ...etc
In reply to Re: OOP design related question.
by Ctrl-z
in thread OOP design related question.
by techcode
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |