DBIx::Class - Related Tables

Minty mintywalker at gmail.com
Tue Oct 7 10:10:31 BST 2008

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.

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.

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.

More information about the london.pm mailing list