[Dbix-class] Problem getting data from resultset
Patrick Meidl
patrick at pantheon.at
Mon Jul 9 20:12:07 GMT 2012
On Mon, Jul 09 2012, John Romkey <romkey at romkey.com> wrote:
> On Jul 9, 2012, at 12:27 PM, Kenneth S Mclane wrote:
> > while (my @data = $sr->next) {
>
> The problem is this line of code.
that's correct. this expression will always evaluate to TRUE, so the
loop won't finish and your code will croak after scalar($st->all)
iterations.
> Try:
>
> while( my $data_scalar = $sr->next ) {
> my @data = $data_scalar->all;
that's wrong, though. DBIx::Class::Resultset->next already returns your
result row, so the code should be:
while (my $data = $sr->next) {
# call accessors on your Accountv object
...
}
HTH
patrick
--
Patrick Meidl ........................ patrick at pantheon.at
Vienna, Austria ...................... http://gplus.to/pmeidl
More information about the DBIx-Class
mailing list