Catmandu::Paged(3pm)
π Catmandu::Paged π
okay bestie, so this is Catmandu::Paged β it's a base class for packages that need to do paging on result sets. it's giving "i do the math so you don't have to" energy and honestly? obsessed. β¨
β¨ SYNOPSIS β¨
# 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;
πΈ DESCRIPTION πΈ
so here's the tea, bestie π« β any package that uses Catmandu::Paged as its base class, and implements the methods start, limit and total, gets a whole lil squad of page-calculation methods for free. no cap, you literally just write three subs and the rest shows up like a gift. π
π OVERWRITE METHODS π
these are the three you gotta bring yourself, bestie. they're the main character methods, fr fr.
start()β returns the index of the first item in a result page.limit()β returns the number of results in a page.total()β returns the total number of search results.
π INSTANCE METHODS π
these ones come free with the class, and they ate. π
first_pageβ returns the index of the first page in a search result containing 0 or more pages.last_pageβ returns the index of the last page in a search result containing 0 or more pages.page_sizeβ returns the number of items on the current page.pageβ returns the current page index.previous_pageβ returns the previous page index.next_pageβ returns the next page index.first_on_pageβ returns the result index of the first result on the page.page_rangespages_in_spreadβ returns the previous pages and next pages, depending on where you're currently at in the result set. π¦
π«Ά SEE ALSO π«Ά
Catmandu::Hitsβ go say hi, bestie π
okay and that's the whole vibe check β
β this page was riding with perl v5.40.1, dated 2026-01-24, and it's part of the User Contributed Perl Documentation collection. slay, you read the whole thing, i'm so proud of you π₯Ήπ periodt.
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms