Teng::Plugin::Pager::MySQLFoundRows - Paginate with SQL_CALC_FOUND_ROWS
package MyApp::DB; use parent qw/Teng/; __PACKAGE__->load_plugin('Pager::MySQLFoundRows'); package main; my $db = MyApp::DB->new(dbh => $dbh); my $page = $c->req->param('page') || 1; my ($rows, $pager) = $db->search_with_pager('user' => {type => 3}, {page => $page, rows => 5});
This is a helper class for pagination. This helper only supports MySQL. Since this plugin uses SQL_CALC_FOUND_ROWS for calculate total entries.
Select from database with pagination.
The arguments are mostly same as $db-search()>. But two additional options are available.
$db-
Current page number.
The number of entries per page.
This method returns ArrayRef[Teng::Row] and instance of Teng::Plugin::Pager::Page.
Tokuhiro Matsuno
To install Teng, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Teng
CPAN shell
perl -MCPAN -e shell install Teng
For more information on module installation, please visit the detailed CPAN module installation guide.