Skip to content

neilb/Data-Page-NoTotalEntries

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

Data::Page::NoTotalEntries - help when paging through sets of results without total entries

SYNOPSIS

use Data::Page::NoTotalEntries;

DESCRIPTION

Data::Page::NoTotalEntries is a generic pager object, so it's very similar with Data::Page. But so Data::Page::NoTotalEntries doesn't support $pager->total_entries and other some methods.

In sometime, I don't want to count total entries, because counting total entries from database are very slow.

METHODS

my $pager = Data::Page::NoTotalEntries->new(%args);

Create new instance of Data::Page::NoTotalEntries. You can initialize attributes at constrcutor with %args.

$pager->next_page()

This method returns the next page number, if one exists. Otherwise it returns undefined:

if ($page->next_page) {
    print "Next page number: ", $page->next_page, "\n";
}
$pager->previous_page()

This method returns the previous page number, if one exists. Otherwise it returns undefined:

if ($page->previous_page) {
    print "Previous page number: ", $page->previous_page, "\n";
}
$pager->prev_page()

This is a alias for $pager->previous_page()

$pager->first()

This method returns the number of the first entry on the current page.

$pager->last()

This method returns the number of the last entry on the current page.

ATTRIBUTES

has_next: Bool

Does this page has a next page?

entries_per_page: Int

The number of entries in each page.

current_page : Int

This attribute is the current page number:

entries_on_this_page: Int

This attribute is the number of entries on the current page

AUTHOR

Tokuhiro Matsuno <tokuhirom AAJKLFJEF GMAIL COM>

SEE ALSO

Data::Page is a pager component but requires the number of total entries.

LICENSE

Copyright (C) Tokuhiro Matsuno

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Perl 100.0%