Data::SpreadPagination is a Perl module for page numbering and spread pagination.
SYNOPSIS
use Data::SpreadPagination;
my $pageInfo = Data::SpreadPagination->new({
totalEntries => $totalEntries,
entriesPerPage => $entriesPerPage,
# Optional, will use defaults otherwise.
# only 1 of currentPage / startEntry can be provided.
currentPage => $currentPage,
startEntry => $startEntry,
maxPages => $maxPages,
});
# General page information
print " First page: ", $pageInfo->first_page, "n";
print " Last page: ", $pageInfo->last_page, "n";
print " Next page: ", $pageInfo->next_page, "n";
print " Previous page: ", $pageInfo->previous_page, "n";
# Results on current page
print "First entry on page: ", $pageInfo->first, "n";
print " Last entry on page: ", $pageInfo->last, "n";
# Page range information
my $pageRanges = $pageInfo->page_ranges;
# Print out the page spread
foreach my $page ($pageInfo->pages_in_spread()) {
if (!defined $page) {
print "... ";
} elsif ($page == $pageInfo->current_page) {
print "$page ";
} else {
print "$page ";
}
}
The object produced by Data::SpreadPagination can be used to create a spread pagination navigator. It inherits from Data::Page, and has access to all of the methods from this object.
In addition, it also provides methods for creating a pagination spread, to allow for keeping the number of pagenumbers displayed within a sensible limit, but at the same time allowing easy navigation.
The object can easily be passed to a templating system such as Template Toolkit or be used within a script.
Product's homepage
Requirements:
· Perl