DBIx::Class - Related Tables

Dave Hodgkinson davehodg at gmail.com
Tue Oct 7 10:54:29 BST 2008


On 7 Oct 2008, at 10:10, Minty wrote:

> On Tue, Oct 7, 2008 at 9:03 AM, Dave Hodgkinson <davehodg at gmail.com>  
> wrote:
>> Then what's the benefit of an ORM? (general question, not just to  
>> you :)
>
> Dunno about ORMs in general, but being able to pass a DBIx::Class
> object into a TT template and have the template query the various
> values and pull out the things they want seems like a big win.


Which seems completely contra to Separation of Concern.

Punching through from template to data seems to be binding the layers
together very tightly, making testing Hard.

>
>
> Especially the object chaining
>
> my $vars = { module => $db->resultset('Module')->single({  ...some
> criteria ...}) };
> $template->process('mytemplate.tt', $vars)
>
> [% module.author.email | html %]
>
> I'm not sure it's the best example - I'm thinking about where your
> tables are connected in the schema, which lets you query tables that
> can join the 'module' table simply by using . in the template.  Thus
> the above 'module' table would only contain an 'author_id' column, and
> the 'author' table would contain the 'email' column.
>
> <0.02>
> I have in the past been wary of ORMs where you spend all your time
> learning the implementation details and being comfortably numb about
> the underlying theory.
>
> DBIx::Class I've taken a strong liking to tho fwiw.  Like jquery, when
> the abstraction is done well, it makes a lot of things better/shorter.
> </0.02>

-- 
Dave Hodgkinson                                MSN: davehodg at hotmail.com
Site: http://www.davehodgkinson.com                   UK: +44 7768 49020
Blog: http://davehodg.blogspot.com                    NL: +31 654 982906
Photos: http://www.flickr.com/photos/davehodg







More information about the london.pm mailing list