package HTML::Pager;
=head1 NAME
HTML::Pager - Perl module to handle CGI HTML paging of arbitary data
=head1 SYNOPSIS
use HTML::Pager;
use CGI;
# get CGI query object
my $query = CGI->new();
# create a callback subroutine to generate the data to be paged
my $get_data_sub = sub {
my ($offset, $rows) = @_;
my @return_array;
for (my $x = 0; $x < $rows; $x++) {
push(@return_array, [ time() ]);
}
return \@return_array;
}
# create a Pager object
my $pager = HTML::Pager->new(
# required parameters
query => $query,
get_data_callback => $get_data_sub,
rows => 100,
page_size => 10,
# some optional parameters
persist_vars => ['myformvar1',
'myformvar2',
'myformvar3'],
cell_space_color => '#000000',
cell_background_color => '#ffffff',
nav_background_color => '#dddddd',
javascript_presubmit => 'last_minute_javascript()',
debug => 1,
);
# make it go - send the results to the browser.
print $pager->output;
=head1 DESCRIPTION
This module handles the paging of data coming from an arbitrary source
and being displayed using HTML::Template and CGI.pm. It provides
an interface to pages of data similar to many well-known sites, like
altavista.digital.com or www.google.com.
This module uses HTML::Template to do all its HTML generation. While
it is possible to use this module without directly using
HTML::Template, it's not very useful. Modification of the
look-and-feel as well as the functionality of the resulting HTML
should all be done through HTML::Template objects. Take a look at
L for more info.
=cut
use strict;
use integer;
use HTML::Template;
$HTML::Pager::VERSION = '0.03';
=head1 METHODS
=head2 C
The new() method creates a new Pager object and prepares the data for
C