<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>i believe you are getting an array-ref because you are calling it in list context via the [ ... ] here.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>  my $myalums  = [ $c-&gt;model('MyDB::Alumni')-&gt;search({}, { rows =&gt; 20  }) ] ;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>try:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>    my $myalums_iter  = $c-&gt;model('MyDB::Alumni')-&gt;search({}, { rows =&gt; 20  });</DIV><DIV>    while (my $alum = $myalums_iter-&gt;next) { ... }</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR><DIV><DIV>On Jun 19, 2007, at 11:16 AM, John Goulah wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><BR><BR><DIV><SPAN class="gmail_quote">On 6/19/07, <B class="gmail_sendername">John Napiorkowski</B> &lt;<A href="mailto:jjn1056@yahoo.com">jjn1056@yahoo.com</A>&gt; wrote:</SPAN><BLOCKQUOTE class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <BR>--- John Goulah &lt;<A href="mailto:jgoulah@gmail.com">jgoulah@gmail.com</A>&gt; wrote:<BR><BR>&gt; If I do something simple like this:<BR>&gt;<BR>&gt;      my $myalums  = [<BR>&gt; $c-&gt;model('MyDB::Alumni')-&gt;search({}, { rows =&gt; 20 <BR>&gt; })<BR>&gt; ] ;<BR>&gt;<BR>&gt; and stash it:<BR>&gt;     $c-&gt;stash-&gt;{alumni} = $myalums;<BR>&gt;<BR>&gt; I am able to iterate in the template like:<BR>&gt;<BR>&gt;    [% FOREACH alum IN alumni -%]<BR>&gt;        id: [% alum.alumni_id %]  &lt;br /&gt;<BR>&gt;    [% END -%]<BR>&gt;<BR>&gt;<BR>&gt; But if I try to iterate this in the controller, I<BR>&gt; cannot do something like:<BR>&gt;<BR>&gt;     while (my $alum = $myalums-&gt;next) {<BR> &gt;         $c-&gt;log-&gt;debug("id: ". $alum-&gt;alumni_id);<BR>&gt;     }<BR><BR>Because -&gt;next isn't a method on an array reference.<BR>You could try derefing via @$myalumns.</BLOCKQUOTE><DIV><BR><BR> I have tried a few things here.  I can get this to work:<BR><BR><BR>     for my $element (@{$myalums}) {<BR>         $c-&gt;log-&gt;debug("alum:". $element-&gt;alumni_id);<BR>     }<BR><BR><BR>but not :<BR><BR>    while (my $alum = @{$myalums}-&gt;next) {<BR>        $c-&gt;log-&gt;debug("id: ". $alum-&gt;alumni_id);<BR>    }<BR><BR>In this case I get: <BR><PRE><CODE class="error">Can't call method "next" without a package or object reference
</CODE></PRE><BR><BR>I'm assuming I'm just doing something obviously wrong here?<BR><BR>Thanks!<BR>John<BR><BR><BR><BR> </DIV><BR></DIV><BR><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">List: <A href="mailto:Catalyst@lists.rawmode.org">Catalyst@lists.rawmode.org</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Listinfo: <A href="http://lists.rawmode.org/mailman/listinfo/catalyst">http://lists.rawmode.org/mailman/listinfo/catalyst</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Searchable archive: <A href="http://www.mail-archive.com/catalyst@lists.rawmode.org/">http://www.mail-archive.com/catalyst@lists.rawmode.org/</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Dev site: <A href="http://dev.catalyst.perl.org">http://dev.catalyst.perl.org</A>/</DIV> </BLOCKQUOTE></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>---</DIV><DIV>michael reece :: software engineer :: <A href="mailto:mreece@vinq.com">mreece@vinq.com</A></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>