[Dbix-class] Pagination support

Andy Grundman andy at hybridized.org
Mon Sep 5 21:57:35 CEST 2005


Pagination support has recently been added to the DBIC trunk.

The native interface works like this:

my $it = DBICTest::CD->search(
     {},
     { order_by => 'title',
       rows => 3,
       page => 1 }
);

This will give you a standard iterator containing the first page of data 
(3 items in this case).

$it->pager will give you a Data::Page object.

You can also page an existing resultset:

my $it = DBICTest::CD->search(
   {},
   { order_by => 'title',
     rows => 3 }
);
my $page = $it->page(2); # returns an iter for the second page of data

Sweet-style syntax is available when using the CDBICompat layer:

my ( $pager, $it ) = Class->page( ... );

-Andy



More information about the Dbix-class mailing list