Mongol::Roles::Pagination - Pagination for Mongol models
use POSIX qw( ceil ); use Data::Dumper; my $page = Models::Person->paginate( { age => { '$gt' => 25 } }, 0, 10 ); my $total_pages = ceil( $page->total() / $page->rows() ); my $current_page = ( $page->start() / $page->rows() ) + 1; printf( "%s", Dumper( $page->serialize() ) );
my $page = Models::Person->paginate( { first_name => 'John' }, 0, 10, {} );
Mongol::Models::Page
To install Mongol, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mongol
CPAN shell
perl -MCPAN -e shell install Mongol
For more information on module installation, please visit the detailed CPAN module installation guide.