Dancer::Plugin::Paginate - HTTP 1.1 Range-based Pagination for Dancer apps.
Version 1.0.2
HTTP 1.1 Range-based Pagination for Dancer apps.
Provides a simple wrapper to provide pagination of results via the HTTP 1.1 Range headers for AJAX requests.
To use, simply add the "paginate" keyword to any route that should support HTTP Range headers. The HTTP Request will be processed and Dancer session variables will be populated with the items being requested.
use Dancer::Plugin::Paginate; get '/data' => paginate sub { ... } ...
Options: true|false
Default: true
Determines if paginate should only operate on Ajax requests.
Options: headers|parameters|both
Default: headers
Controls if paginate will look for the pagination in the headers, parameters, or both.
If set to both, headers will be preferred.
Header mode will look for the following 2 Headers:
Both are required.
You can read more about these at http://www.ietf.org/rfc/rfc2616.txt and http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p5-range-latest.html.
Range-Unit will be returned to your app, but is not validated in any way.
Parameters mode will look the following parameters in any of Dancer's parameter sources (query, route, or body):
Start and End are required. Range-Unit will be populated with an empty string if not available.
The paginate keyword is used to add a pagination processing to a route. It will:
Vars:
In your response, you an optionally provide the following Dancer Session Variables to customize response:
Colin Ewen, <colin at draecas.com>
<colin at draecas.com>
Please report any bugs or feature requests to bug-dancer-plugin-paginate at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dancer-Plugin-Paginate. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-dancer-plugin-paginate at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Dancer::Plugin::Paginate
This is developed on GitHub - please feel free to raise issues or pull requests against the repo at: https://github.com/Casao/Dancer-Plugin-Paginate.
My thanks to David Precious, <davidp at preshweb.co.uk> for his Dancer::Plugin::Auth::Extensible framework, which provided the Keyword syntax used by this module. Parts were also used for testing purposes.
<davidp at preshweb.co.uk>
Copyright 2014 Colin Ewen.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
To install Dancer::Plugin::Paginate, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Plugin::Paginate
CPAN shell
perl -MCPAN -e shell install Dancer::Plugin::Paginate
For more information on module installation, please visit the detailed CPAN module installation guide.