[Melbourne-pm] Any DBIx::Class gurus around?

Simon Taylor simon at unisolve.com.au
Wed Sep 29 19:51:29 PDT 2010


Hello Toby,

> DBIx::Class works really well for dealing with bunches of rows as if
> they were objects, but not as well when it comes to reporting queries.
>
> I'd advise looking at the perldoc for ResultSource::View, and then
> creating a package that is one, which encapsulates the reporting
> query, or at least a generic version of it.
>
> Then you could do something like:
> my $query = $schema->resultset('Report::Staff'Projects')->search;
> Or to restrict it to certain staff, eg:
> my $query = $schema->resultset('Report::Staff'Projects')->search(
>    { staffid =>  { '<' =>  1000 } }
> );
>
>    

Thanks for this. I wasn't aware of  ResultSource::View and we too are 
struggling with using
DBIx::CLASS for reporting, but otherwise we're happy with it.

Cheers,

Simon




More information about the Melbourne-pm mailing list