Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re (tilly) 1: Apache::DBI and DBI subclasses

by Hrunting (Pilgrim)
on Dec 09, 2001 at 20:31 UTC ( [id://130529]=note: print w/replies, xml ) Need Help??


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.
  • Comment on Re: Re (tilly) 1: Apache::DBI and DBI subclasses

Replies are listed 'Best First'.
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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://130529]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-04-19 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found