<tt><font size=2>John Romkey <romkey@romkey.com> wrote on 07/09/2012
11:48:34 AM:<br>
<br>
> Re: [Dbix-class] Problem getting data from resultset</font></tt>
<br><tt><font size=2>> <br>
> On Jul 9, 2012, at 12:27 PM, Kenneth S Mclane wrote:</font></tt>
<br><tt><font size=2>> while (my @data =
$sr->next) { </font></tt>
<br><tt><font size=2>> <br>
> The problem is this line of code. @data in a scalar context will <br>
> evaluate to the index of the last element of the array (-1 if the
<br>
> array is empty) (assuming you haven't changed the index of the first<br>
> element of arrays). The loop will succeed even when $sr->next <br>
> returns undefined.</font></tt>
<br><tt><font size=2>> <br>
> Try:</font></tt>
<br><tt><font size=2>> <br>
> while( my $data_scalar = $sr->next ) {</font></tt>
<br><tt><font size=2>> my @data = $data_scalar->all;</font></tt>
<br><tt><font size=2>> <br>
> instead</font></tt>
<br><tt><font size=2>> <br>
</font></tt>
<br><tt><font size=2>I actually changed it to this: my @data = $sr->all;
I think this is equivalent isn't it? This does not give me any errors,
but only outputs one row to the file.</font></tt>