Template::Plugin::Pagination - a plugin to help paginate pages of results
[% USE page = Pagination(items, current_page, entries_per_page) %] [% FOREACH item IN page.page_data; ...; DONE %] First page: [% page.first_page %] Prev page: [% page.previous_page %] Next page: [% page.next_page %] Last page: [% page.last_page %]
This plugin helps you construct pages that include subsets of data from a list, such as search results which you'll paginated in groups of 10.
It's based heavily on Template::Plugin::Page, which you should see for a detailed example of to use this. (That module is a thin wrapper around Data::Page, whereas this one is a wrapper around Data::Paginated, which is Data::Page + Data::Pageset + some extras).
This is the constructor. It has one mandatory arguments: the list of items we're working with. You can also pass the page number you're currently working with which will otherwise default to 1) and the number of entries there will be on each page (which defaults to 10).
You now have available all the methods from Data::Page, Data::Pageset and Data::Paginated, including:
See their manual pages for details.
Tony Bowden, <cpan@tmtm.com>
Please direct all correspondence regarding this module to: bug-Template-Plugin-Pagination@rt.cpan.org
Template::Plugin::Page, Data::Page, Data::Pageset, Data::Paginated
Copyright (C) 2004-2006 Tony Bowden. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself
To install Template::Plugin::Pagination, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::Pagination
CPAN shell
perl -MCPAN -e shell install Template::Plugin::Pagination
For more information on module installation, please visit the detailed CPAN module installation guide.