On Fri, 13 Aug 2004 15:32:03 -0400, Perrin Harkins <[EMAIL PROTECTED]> wrote:
> On Fri, 2004-08-13 at 15:25, John Siracusa wrote:
> > What does a DBIx::* module have to do in order to correctly call
> > Apache::DBI's no-op version of disconnect() when running under mod_perl with
> > Apache::DBI?
> 
> It needs to not set RootClass.  Apache::DBI essentially subclasses DBI,
> which is what RootClass does as well.

Er, yeah, "essentially" :)  All the crazy re-blessing that goes on is quite
a mess, IMO.

So what you're saying is that DBIx::* and Apache::DBI will simply never get
along because they both want to do the same thing, but use different (and
apparently incompatible) methods to do so?

> > Run it under httpd -X to further isolate the problem and you'll see that the
> > first request works, but all subsequent requests fail.  This happens because
> > the disconnect() call actually calls the "real" disconnect method instead of
> > the Apache::DBI implementation, which is a no-op.
> 
> Why call disconnect at all?  Are you trying to run this as normal CGI
> too?

The first answer is that I'm calling disconnect because it's The Right Thing
To Do.  Maybe some people think just letting things go out of scope is more
"(mod_)perl-ish", but I always wonder if those people don't call close(FILE)
either ;)  Anyway, I'm not one of those people.

The second answer is that it's common (and usually desirable) for certain
DBI-using modules to be used both in both web and offline contexts.  (The
example was heavily simplified, obviously.)

-John



-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to