in reply to Re (tilly) 1: Apache::DBI and DBI subclasses in thread Apache::DBI and DBI subclasses
Well, the big 'gotcha' with subclasses Apache::DBI is that you can only use it that you need to be running under mod_perl to do it, but I suppose you could do some sort of environment check right before you decide which modules to include and which classes to subclass.
Re (tilly) 3: Apache::DBI and DBI subclasses
by tilly (Archbishop) on Dec 09, 2001 at 21:54 UTC
|
Well, whether this is doable depends on what you wanted
to do. But Perl does have multiple inheritance. You can
choose to inherit directly from Apache::DBI and then
directly from DBI. So you are a subclass of both, and if
Apache::DBI isn't there things still have a chance to work.
I say chance because if Apache::DBI and DBI do something
differently enough, you might have to work around the
difference.
Another approach is to reconsider doing any
subclassing. What you want to do is preserve the
interface, right? Well you can have an object that has an
attribute which is the database handle it proxies through
with an AUTOLOAD method. You can see an example of how to
do that at Re (tilly) 1: Reverse Inheritance Irritance. And now you can wrap either one
of them without having to do a lot of work... | [reply] |
|