[Dbix-class] Components for ResultSets?

Chris Weyl cweyl at alumni.drew.edu
Wed May 5 16:38:51 GMT 2010


On Wed, May 5, 2010 at 5:29 AM, Calle Dybedahl <calle at init.se> wrote:
> So, in brief, I wonder if it's possible to do for ResultSets what components do for Results, and if so how.

When I've needed to do this, I generally create custom ResultSet classes.

A "base class" that contains all the bits every ResultSet in the
schema will need, and both use it as the default RS class and as the
base for other specific classes.  This gets the methods you need in
every RS out there.

Using Moose roles to contain common sets of functionality a subset of
the RS classes may need is a good approach (IMHO) to handling this
case with a minimum amount of fuss.  Just create roles with the
methods needed and compose them into the relevant RS classes.

                            -Chris
-- 
Chris Weyl
Ex astris, scientia



More information about the DBIx-Class mailing list