} elsif ($action eq 'nextval') { my $oldrow = $row; $row = $sth->fetchrow_arrayref; return $oldrow->[0]; } #### sub dbi_query_iterator { my ($sth, @params) = @_; $sth->execute(@params) or return; my $row = $sth->fetchrow_arrayref() return Iterator { my $action = shift() || 'nextval'; if ($action eq 'exhausted?') { return ! defined $row; } elsif ($action eq 'nextval') { my $oldrow = $row; $row = $sth->fetchrow_arrayref; return $oldrow->[0]; } }