Perl Diver 2.33
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Class::DBI::Iterator

Name Class::DBI::Iterator
Version
Located at /usr/share/perl5
File /usr/share/perl5/Class/DBI/Iterator.pm
Is Core No
Search CPAN for this module Class::DBI::Iterator
Documentation Class::DBI::Iterator
Module Details Class::DBI::Iterator

NAME

Class::DBI::Iterator - Iterate over Class::DBI search results


SYNOPSIS

        my $it = My::Class->search(foo => 'bar');
        my $results = $it->count;
        my $first_result = $it->first;
        while ($it->next) { ... }
        my @slice = $it->slice(10,19);
        my $slice = $it->slice(10,19);
        $it->reset;
        $it->delete_all;


DESCRIPTION

Any Class::DBI search (including a has_many method) which returns multiple objects can be made to return an iterator instead simply by executing the search in scalar context.

Then, rather than having to fetch all the results at the same time, you can fetch them one at a time, potentially saving a considerable amount of processing time and memory.


CAVEAT

Note that there is no provision for the data changing (or even being deleted) in the database inbetween performing the search and retrieving the next result.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2026