[Dbix-class] Having access to both resultset list AND resultset
methods
Emily Heureux
emily at burnham.org
Mon Apr 7 18:33:32 BST 2008
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.
But, now I want to make other calls from within my perl code, using my $rs
variable, like $rs->count, etc. But, I have to remove the brackets, which
causes me to lose the ability to access the table information in the tt2
file.
How can I have both? The error I get if I leave the brackets on is:
"Can't call method "count" on unblessed reference at .
Incidentally, I have remembered to put 'add_columns' in all of my
DB::TableX.pm files with all the columns for that table.
I have tried things like, leaving the brackets off above, and then sending
$rs_ref = [$rs] to the stash instead of $rs, sending \$rs, etc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080407/01c809ea/attachment.htm
More information about the DBIx-Class
mailing list