[Dbix-class] Having access to both resultset list AND resultset methods

Eden Cardim edencardim at gmail.com
Mon Apr 7 19:46:14 BST 2008


On Mon, Apr 7, 2008 at 2:33 PM, Emily Heureux <emily at burnham.org> wrote:
> Hi, I have a resultset call like this in my Catalyst application:
> $rs = [$c->model('DB::Table1)->search(
>
>             { …
>
>             },
>
>             { join => [ …]
>
>             }
>
>          )];
> The reason for the brackets is, in my tt2 file, I can make a call directly
> to the table column:
>
> [% FOREACH result IN rs %]
>
>    [% result.table1.column1 %]
>
> [% END %]
>
> and it works perfectly.

Don't stash an anonymous list, if you need the object list from the
resultset just call:

[% FOREACH result IN rs.all %]

further reading: perldoc DBIx::Class::ResultSet

-- 
edenc.vox.com



More information about the DBIx-Class mailing list