You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Mike Miller <mm...@crusoe.net> on 2000/11/21 14:11:17 UTC

[OT] Re:moidperl, OOP & DBI

Hi Ilya,

IS> I  am creating an object that make queries to database. But how shall I
IS> explain to him what database handler he shall use?
IS> Under mod_perl it is too dangerous to make $dbh global variable.
IS> Well, I can create data field in this object that will store current $dbh,
IS> but it seems too strange too me to have such data field in object:

I'd take a look at Damian Conway's book Object Oriented Perl.  Has
some good examples and pointers on this stuff.  (ISBN 1-884777-79-1.)

FWIW, I think its okay to have database connectors (or pointers to)
within the objects.  If you look at an object as being
self-sufficient, how else can it connect to the database .... That's
just my opinion, though.

This is really not a true mod_perl issue, however.  Sorry for veering
off-topic.

Best Regards,

Mike Miller
mmiller@crusoe.net