[Catalyst] Re: iterating ResultSet in controller vs. template
A. Pagaltzis
pagaltzis at gmx.de
Wed Jun 20 18:25:51 GMT 2007
Hi John,
* John Goulah <jgoulah at gmail.com> [2007-06-19 19:10]:
> If I do something simple like this:
>
> my $myalums = [ $c->model('MyDB::Alumni')->search({}, { rows => 20 })
> ] ;
>
> But if I try to iterate this in the controller, I cannot do something like:
>
> while (my $alum = $myalums->next) {
> $c->log->debug("id: ". $alum->alumni_id);
> }
* John Goulah <jgoulah at gmail.com> [2007-06-19 20:25]:
> while (my $alum = @{$myalums}->next) {
> $c->log->debug("id: ". $alum->alumni_id);
> }
>
> In this case I get:
>
> Can't call method "next" without a package or object reference
this is not a problem with DBIx::Class (much less with Catalyst).
Your understanding of Perl data structures is evidently
superficial; you will do yourself a favour to read at least one
of the perlreftut, perllol and perldsc docs.
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
More information about the Catalyst
mailing list