[Catalyst] iterating ResultSet in controller vs. template

John Goulah jgoulah at gmail.com
Tue Jun 19 20:09:29 GMT 2007

On 6/19/07, Michael Reece <mreece at vinq.com> wrote:
> i believe you are getting an array-ref because you are calling it in list
> context via the [ ... ] here.
>   my $myalums  =3D [ $c->model('MyDB::Alumni')->search({}, { rows =3D> 20=
> ] ;
> try:
>     my $myalums_iter  =3D $c->model('MyDB::Alumni')->search({}, { rows =
> 20  });
>     while (my $alum =3D $myalums_iter->next) { ... }

You are correct (and I did explain that as well in my original post that was
happening).  So the question is , how can I make the same call and access
the data in both places?  It seems silly that I have to make the call
without brackets to access in the controller, and with brackets to access in
the template, so I assume I am accessing the object incorrectly in one place
or the other, but I would like to be able to use ->next in the controller.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070619/45626=

More information about the Catalyst mailing list