[Catalyst] Re: iterating ResultSet in controller vs. template

John Goulah jgoulah at gmail.com
Wed Jun 20 22:04:04 GMT 2007


On 6/20/07, A. Pagaltzis <pagaltzis at gmx.de> wrote:
>
> Hi John,
>
> * John Goulah <jgoulah at gmail.com> [2007-06-19 19:10]:
> > If I do something simple like this:
> >
> >     my $myalums  =3D [ $c->model('MyDB::Alumni')->search({}, { rows =3D=
> 20
> })
> > ] ;
> >
> > But if I try to iterate this in the controller, I cannot do something
> like:
> >
> >    while (my $alum =3D $myalums->next) {
> >        $c->log->debug("id: ". $alum->alumni_id);
> >    }
>
> * John Goulah <jgoulah at gmail.com> [2007-06-19 20:25]:
> >    while (my $alum =3D @{$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.



Your reading of this thread is evidently superficial since it was answered
several times over with _much_ more helpful answers.   Sorry if I opened my
ignorant mouth, but I thought it fit into this list since it dealt with
model, view, and controller code.


Thanks,
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070620/578d9=
f27/attachment-0001.htm


More information about the Catalyst mailing list