in reply to DBI Row Limiting

You can override fetchall_arrayref method.

Just create dbilimit.pl

use strict; package DBI; my $fetchall_arrayref; our $ROWS_LIMIT; INIT { $ROWS_LIMIT = 10; $fetchall_arrayref = \&fetchall_arrayref; } no warnings; sub fetchall_arrayref { my ($sth, $slice, $max_rows) = @_; $max_rows = $ROWS_LIMIT unless defined $max_rows; $fetchall_arrayref->($sth, $slice, $max_rows); } 1;
and require it after use DBI; line

P.S. the code is not tested so it may have some bugs

Replies are listed 'Best First'.
Re^2: DBI Row Limiting
by ketema (Scribe) on Sep 14, 2004 at 18:29 UTC
    This what I was looking for! I didn't want to have to re-write every instance of a fetchall_arrayref or hashref in the code to a while fetch loop, that would have chaned the logic pf the program. Overridding the methods in this manner is much more concise and easier. Thank you, it did the job.