NAME
    Data::Page - help when paging through sets of results

SYNOPSIS
      use Data::Page;

      my $page = Data::Page->new($total_entries, $entries_per_page, $current_page);

      print "         First page: ", $page->first_page, "\n";
      print "          Last page: ", $page->last_page, "\n";
      print "First entry on page: ", $page->first, "\n";
      print " Last entry on page: ", $page->last, "\n";

DESCRIPTION
    When searching through large amounts of data, it is often the case that
    a result set is returned that is larger than we want to display on one
    page. This results in wanting to page through various pages of data. The
    maths behind this is unfortunately fiddly, hence this module.

    The main concept is that you pass in the number of total entries, the
    number of entries per page, and the current page number. You can then
    call methods to find out how many pages of information there are, and
    what number the first and last entries on the current page really are.

METHODS
  new

    This is the constructor. It currently takes two mandatory arguments, the
    total number of entries and the number of entries per page. It also
    optionally takes the current page number (which defaults to 1).

      my $page = Data::Page->new($total_entries, $entries_per_page, $current_page);

      my $page = Data::Page->new(134, 10);

      my $page = Data::Page->new(134, 10, 5);

  total_entries

    This method returns the total number of entries.

      print "Entries:", $page->total_entries, "\n";

  entries_per_page

    This method returns the total number of entries per page.

      print "Per page:", $page->entries_per_page, "\n";

  current_page

    This method returns the current page number.

      print "Page: ", $page->current_page, "\n";

  first_page

    This method returns the first page. This is put in for reasons of
    symmetry with last_page, as it always returns 1.

      print "Pages range from: ", $page->first_page, "\n";

  last_page

    This method returns the total number of pages of information.

      print "Pages range to: ", $page->last_page, "\n";

  first

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

      print "Showing entries from: ", $page->first, "\n";

  last

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

      print "Showing entries to: ", $page->last, "\n";

AUTHOR
    Based on code originally by Leo Lapworth <leo@cuckoo.org>, with many
    changes added by by Leon Brocard <acme@astray.com>.

COPYRIGHT
    Copyright (C) 2000-1, Leon Brocard

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

