Perl: the Markov chain saw | |
PerlMonks |
Apache::DBI and DBI subclassesby Hrunting (Pilgrim) |
on Dec 09, 2001 at 07:01 UTC ( [id://130499]=perlquestion: print w/replies, xml ) | Need Help?? |
Hrunting has asked for the wisdom of the Perl Monks concerning the following question:
I've posted this to a couple of mailing lists and haven't received any answers, so maybe the folks at perlmonks can give some insight. According to the subclassing posts that are out there, one of the things that you're supposed to do when subclassing DBI is to call __PACKAGE__->init_rootclass(). That works fine. However, when you use Apache::DBI, Apache::DBI will be used to make the connection, but an Apache::DBI::db connection won't be returned to you; a connection from your class will. If the init_rootclass() is removed from the subclass, all works as expected, but of course, you lose any adjustments you may have made withing subclass::db and subclass::st. Does anyone know of a workaround to this? It seems a shame to lose the persistent functionality of Apache::DBI if you want to use subclassed DBI::db and ::st objects. Conversely, it seems stupid to have to reinvent the Apache::DBI wheel when you have subclasses. From what I've read in Apache::DBI's code, I suspect that a partial rewrite of Apache::DBI would be needed to support subclassed DBI objects, but I wanted to hear at least *some* opinions on the matter, first.
Back to
Seekers of Perl Wisdom
|
|