Re: OO Architecture

[email protected] (Honza Pazdziora) Wed, 28 Sep 2005 11:54:09 +0200
Newsgroups perl.dbi2.dev
Message-ID <[email protected]>
On Tue, Sep 27, 2005 at 11:55:20PM -0700, Ask Bjørn Hansen wrote:
> 
> On Sep 27, 2005, at 23:45 , Jeff Urlwin wrote:
> 
> >>What examples of DBI subclassing can you show to prove your case?
> >>
> >
> >Hmm...isn't Apache::DBI an example?
> 
> No, it's not subclassing DBI.   (DBI sets "connect_via" to  
> Apache::DBI::connect if it sees that Apache::DBI is loaded).

Actually, Apache::DBI not only is not a subclass, it is a nasty
hack in DBI. ;-) Even if greatly usefull. I cannot write my own
module MySite::PersistentDBI and get the same prominent handling from
DBI as Apache::DBI gets.

(Actually I could if the code in DBI.pm be changed to

	if (not defined $DBI::connect_via) {
		$DBI::connect_via = "connect";
	}

and have Apache::DBI do

	$DBI::connect_via = "Apache::DBI::connect";

Tim, could you spend two lines on why didn't you use this approach?)

> (and my 2 I too share the sentiment that being able to subclass seems  
> like it'd be useful and open up to interesting developments in the  
> future, but I too can't think of any examples.  :-)

Would DBIx::ShowCaller qualify?

	http://search.cpan.org/src/JANPAZ/DBIx-ShowCaller-0.80/ShowCaller.pm

-- 
------------------------------------------------------------------------
 Honza Pazdziora | [email protected] | http://www.fi.muni.cz/~adelton/
 .project: Perl, mod_perl, DBI, Oracle, large Web systems, XML/XSL, ...
		Only self-confident people can be simple.