Data::Page::Pagination - calculates the pagination view
0.005
require Data::Page::Pagination; require Data::Page; my $p = Data::Page::Pagination->new( page => Data::Page->new(110, 10, 6), page_numbers => 11, ); $p->visible_previous_page; # 5< ( $p->previous_page ) $p->visible_first_page; # 1 ( $p->first_page ) $p->visible_hidden_previous; # .. @{ $p->previous_pages }; # 3 4 5 ( max_length = $p->max_list_length ) $p->page->current_page; # 6 ( $p->current_page ) @{ $p->next_pages }; # 7 8 9 ( max_length = $p->max_list_length ) $p->visible_hidden_next, # .. $p->visible_last_page; # 11 ( $p->last_page ) $p->visible_next_page; # >7 ( $p->next_page ) $p->render_plaintext eq '5< 1 .. 3 4 5 [6] 7 8 9 .. 11 >7';
Inside of this Distribution is a directory named example. Run this *.pl files.
This module calculates the pagination view using a Date::Page object. The provided methods are simple enough to use them in a template system.
"page_numbers" is the count of pages for directly access.
my $pagination = Data::Page::Pagination->new( page => Data::Page->new(...), page_numbers => $integer_greater_than_2, );
Returns the number of the current page
$positive_integer = $pagination->current_page;
Returns the maximal length of the list that can be left or right of the current page.
$positive_integer_or_zero = $pagination->max_list_length;
Returns boolean true if there is a previous/last page.
$boolean = $pagination->visible_previous_page; $boolean = $pagination->visible_last_page;
Returns the number of the previous/last page.
$positive_integer = $pagination->previous_page; $positive_integer = $pagination->last_page;
Returns boolean true if the current page is not the fist/last page.
$boolean = $pagination->visible_first_page; $boolean = $pagination->visible_last_page;
Returns the number of the first/last page.
$positive_integer = $pagination->first_page; $positive_integer = $pagination->last_page;
Returns boolean true if more pages then max_list_length pages are between first/last page and current page.
$boolean = $pagination->visible_hiddden_previous; $boolean = $pagination->visible_hiddden_next;
Returns the page numbers before/after the current page, not more then max_list_length.
$array_ref = $pagination->previous_pages; $array_ref = $pagination->next_pages;
Returns the test output.
$string = $pagination->render_plaintext;
Moose exceptions
nothing
Moose
Moose::Util::TypeConstraints
MooseX::StrictConstructor
MooseX::Types::Moose
List::Util
namespace::autoclean
syntax
Syntax::Feature::Method
none
not known
Data::Page
Steffen Winkler
Copyright (c) 2012, Steffen Winkler <steffenw at cpan.org>. All rights reserved.
<steffenw at cpan.org>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Data::Page::Pagination, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Page::Pagination
CPAN shell
perl -MCPAN -e shell install Data::Page::Pagination
For more information on module installation, please visit the detailed CPAN module installation guide.