 more useful options  Re: Why use an OO -> SQL mapper module?
by duelafn (Priest) on Aug 11, 2011 at 19:26 UTC
( #919938=note: print w/ replies, xml ) Need Help??  in reply to
Why use an OO -> SQL mapper module?  "what benefit there is to
replacing the conciseness of a SQL statement (which can be
wrapped up into a method anyways, right?)"  Indeed - my take on
it is that these ORMs are (at one level) just the generalization
of those methods written (and tested) for you already.  You also
end up with some nice tricks that other people found useful like
DBIx::Class's ResultSets which are nice for building up a query
over different chunks of code:  my $store =
$schema->resultset('Items'); $store = restrict_to_department(
$store, $department ) if $department; $store =
restrict_to_seller( $store, $seller ) if $seller; print
format_top_ten_items( $store ); # doesn't care whether $store is
+ restricted sub restrict_to_department { $_[0]->search({ '' =>
$_[1] }, { join => "departments +" }); }  I doubt hand-rolled co