Data-Pageset-Exponential
view release on metacpan or search on metacpan
lib/Data/Pageset/Exponential.pm view on Meta::CPAN
package Data::Pageset::Exponential;
# ABSTRACT: Page numbering for very large page numbers
use v5.20;
use Moo;
use List::Util 1.33 qw( all min );
use PerlX::Maybe qw( maybe );
use POSIX qw( ceil floor );
use MooX::Aliases;
use MooX::TypeTiny;
use Types::Common 2.000000 qw( is_Int Int ArrayRef is_HashRef PositiveOrZeroInt PositiveInt );
use experimental qw( postderef signatures );
use asa 'Data::Page';
use namespace::autoclean;
# RECOMMEND PREREQ: Type::Tiny::XS
# RECOMMEND PREREQ: Ref::Util::XS
our $VERSION = 'v0.4.1';
has total_entries => (
is => 'rw',
isa => PositiveOrZeroInt,
default => 0,
);
has entries_per_page => (
is => 'rw',
isa => PositiveInt,
default => 10,
);
has first_page => (
is => 'ro',
isa => Int,
default => 1,
);
has current_page => (
is => 'rw',
isa => Int,
lazy => 1,
default => \&first_page,
coerce => sub($val) { floor( $val // 0 ) },
);
has exponent_base => (
is => 'ro',
isa => PositiveInt,
default => 10,
);
has exponent_max => (
is => 'ro',
isa => PositiveInt,
default => 3,
);
has pages_per_exponent => (
is => 'ro',
isa => PositiveInt,
default => 3,
);
has pages_per_set => (
is => 'lazy',
isa => PositiveInt,
alias => 'max_pages_per_set',
builder => sub($self) {
( run in 2.571 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )