On Fri, Oct 25, 2002 at 09:27:52AM -0700, Henri Asseily wrote:
> 
> >Are you saying that you'd expect the second call to invoke
> >MySubDBI->connect(...) somewhere along the way?
> 
> Yes, that's correct. I thought both methods would do the same thing 
> (i.e. DBI->connect with a RootClass would fork right away to 
> MyDBI->connect).
> 
> >If so, why are you not just using the first form?
> 
> Because I have 3 very large web applications which can be trivially 
> changed to use MyDBI by simply changing the httpd.conf file to use 
> RootClass. If I have to change DBI->connect, it's more painful and can't 
> be reverted easily.
> I really like the RootClass system because it easily allows you to 
> choose which DB handles you want to subclass.
> 
> I can work around that using the connected() stuff you talked about, so 
> it's not a big deal, but I just thought it wouldn't be too logical to 
> have 2 different behaviors for what seemed (to me) to be the same 
> subclassing idea.

They are similar but slightly different.

Look at it this way, if DBI->connect(...,{ RootClass=>MySubDBI })
called MySubDBI->connect() then MySubDBI->connect would have to
take care to *not* call $self->SUPER::connect(...). Otherwise you'd
get infinite recursion.

Using the connected() method is the way to go.

Tim.

Reply via email to