On Fri, 13 Aug 2004 16:22:00 -0400, Perrin Harkins <[EMAIL PROTECTED]> wrote: >> 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? > > They both subclass, and multiple inheritance might not work here, but > you can try it. Put this code somewhere after you load Apache::DBI: > > psuh @Apache::DBI::st::ISA, 'DBIx::ContextualFetch';
Well, I'm actually using a class that is a subclass of that DBIx:: class, so I just added the disconnect() method (posted earlier) to the subclass. It just seemed odd to me to be doing stuff in service of Apache::DBI, which was totally transparent until then. > Note that this has nothing to do with DBIx::* as a whole. This one > particular module that you are using happens to subclass DBI. Most of > them don't. Ah, so I just got lucky, eh? :) > Now that Perl has lexically scoped filehandles, there isn't any reason > to explicitly call close() in most cases. ;) Tsk, for shame. Just wait until you forget to call close() after writing to a file... ;) > > 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. > > I share a lot of code that way too, but I typically keep the connection > open until the end of the command-line script and then close it there. That assumes the connection was opened by (or is at least accessible from) the script itself. If the connection is opened and managed by a module (which may abstract things such that you aren't even supposed to know whether or not it has to hit a database at all) rather than by your script, that's not an option. I tend to like abstractions like that, and I certainly want "model"-type objects to be able to exist happily in both mod_perl and offline contexts. I also wrap DBI rather than subclass it when I have a choice. Subclassing DBI in general is way too hard, IMO, and it wasn't my choice to use this DBIx:: module, but such is life. I'm mostly just trying to determine if/where to send a bug report. The answer seems to be no/nowhere. -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