Re: Annouce: DBIx::Class, a.k.a "taking the easy way out"

[prev] [thread] [next] [Date index for 2005/07/26]

From: Matt S Trout
Subject: Re: Annouce: DBIx::Class, a.k.a "taking the easy way out"
Date: 23:15 on 26 Jul 2005
On Tue, Jul 26, 2005 at 03:25:09PM -0400, Perrin Harkins wrote:
> On Tue, 2005-07-26 at 19:58 +0100, Matt S Trout wrote:
> > use DBIx::Class::AutoIsa qw/::Core -except -
> > replace ::SQL::Abstract ::SQL::OrderBy -with My::DBIC::SQL::Abstract/;
> 
> Okay, that's scary-looking.  Why invent a language for this when Perl
> works fine?
> 
> DBIx::Class->set_sql_generator('My::DBIC::SQL::Abstract');

It was an idea off the top of my head; I doubt it's right but it was an
interesting exercise to see the responses I got :)

What I'm trying to put across here is that there's no reason why *you*
can't provide a DBIx::Class::Delegates recipe that allows this; my aim
is to enable both this *and* a bunch of other approaches. 

Plus, what if you want to plug-and-play with layers of search generation?
e.g.

My::Search does the WHERE condition
My::OrderBy adds the ORDER BY
My::Limit add the LIMIT clause

How can you arrange to drop in and replace any of the three of these without
something, somewhere, having explicit knowledge of what to replace where?

The problem with what you're talking about is that it ties you down to
specific points to plug in to things. This is fantastic in terms of meeting
the appropriate CS theory guidelines, but in practice you *always* end up
needing something it didn't - hence why many Class::DBI plugins override all
sorts of private methods (Sweet is terrible for this but I had no other
choice). So instead, I'm going to let people override anything however they
like and once a bunch of different approaches have been tried we can sit
down and recommend the best one.

Delegation may turn out to be it, but so far it seems like it's a trade-off
of flexibility vs. simplicity, and I want flexible above all here.

(re-send because I got my posting address wrong, just to the list. originally
cc'ed to a number of people, some of whom have already replied to the list.
hope it doesn't screw your threading up too much, one and all :)

        -- 
             Matt S Trout           Website: http://www.shadowcatsystems.co.uk
  Technical Director        E-mail:  mst (at) shadowcatsystems.co.uk
Shadowcat Systems Ltd.

(message missing)

Delegation vs Hooks (was: Annouce: DBIx::Class, a.k.a "taking the easy way out")
=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?= 23:27 on 26 Jul 2005

Re: Annouce: DBIx::Class, a.k.a "taking the easy way out"
Matt S Trout 23:15 on 26 Jul 2005

Generated at 16:36 on 28 Jul 2005 by mariachi v0.52