Catmandu::Paged(3pm) | User Contributed Perl Documentation | Catmandu::Paged(3pm) |
Catmandu::Paged - Base class for packages that need paging result sets
# Create a package that needs page calculation package MyPackage; use Moo; with 'Catmandu::Paged'; sub start { 12; # Starting result } sub limit { 10; # Number of results per page } sub total { 131237128371; # Total number of results; } package main; my $x = MyPackage->new; printf "Start page: %s\n" , $x->first_page; printf "Last page: %s\n" , $x->last_page; printf "Current page: %s\n" , $x->page; printf "Next page: %s\n" , $x->next_page;
Packages that use Catmandu::Paged as base class and implement the methods "start", "limit" and "total" get for free methods that can be used to do page calculation.
Catmandu::Hits
2023-03-03 | perl v5.36.0 |