1. Perl
  2. Module
  3. here

Data::Page::Navigation - Implementation of page navigation

The Data::Page::Navigation module is a module that adds functionality to Data::Page and is data for page navigation. Can be easily created.

use strict;
use warnings;

use Data::Page;
use Data::Page::Navigation;

my $total_entries = 180;
my $entries_per_page = 10;
my $current_page = 1;
my $pager = Data::Page->new($total_entries, $entries_per_page, $current_page);

# Set the number of page navigation
$pager->pages_per_navigation(10);

# Get data for page navigation
my @pages = $pagesr->pages_in_navigation;

# 1 2 3 4 5 6 7 8 9 10
print "@pages\n";

# Change current page
$pager->current_page(9);
my @pages2 = $pagesr->pages_in_navigation;

# 5 6 7 8 9 10 11 12 13 14
print "@pages2\n";

method

pages_per_navigation

Sets the number of pages displayed on one page. The default is 10.

my $pages_per_navigation = $pagesr->pages_per_navigation;
$pager->pages_per_navigation(15);

pages_in_navigation

This method returns a list of page numbers.

my @pages = $pagesr->pages_in_navigation;
my $pages = $pagesr->pages_in_navigation;

first_navigation_page

Returns the first navigation page.

my $first_page = $pager->first_navigation_page;

last_navigation_page

Returns the last navigation page.

my $last_page = $pager->last_navigation_page;

Related Informatrion