Data::Page::Set - Print page indexes


Data-Page-Set documentation  | view source Contained in the Data-Page-Set distribution.

Index


NAME

Top

Data::Page::Set - Print page indexes

SYNOPSIS

Top

  use Data::Page;
  use Data::Page::Set;

  my @data      = 0 .. 300;
  my $page      = Data::Page->new( scalar @data, 5, shift );
  my $pageset   = Data::Page::Set->new( $page, 6, {} );

  print $pageset->show;

DESCRIPTION

Top

Data::Page::Set->new( $page, $setsize, $showhash );

Arguments

$page [Required]

A Data::Page object.

$setsize [Required]

The size of the pageset: If you have a page object with 20 pages, but you only want to show

<< < 4 5 6 7 8 > >>

Then setsize should be 5 because we're only showing 5 page indexes.

$showhash

A hash with zero or more of the following keys, with a coderef as value wich is executed when we are about to print:

show_first

link to the first page

show_no_first

no link to the first page

show_prev

previous page link

show_no_prev

no link to the previous

show_next

next page link

show_no_next

No next page link

show_last

Last page link

show_no_last

No last page link

show_page

A link to another page

show_current_page

The current page

grepper

Executed in grep { $code->($_) } before the result is joined

joiner

Executed and used as the first argument to join

HISTORY

Top

0.02: Previous and next are show when current page not is first and last resp.

0.04: perl-5.6.1 compatible, tests added

TODO

Top

* Improve joiner/grepper

Joiner and grepper could be replaced with one routine that constructs the return value.

* Generic backend

Data::Page is atm the only pager supported, but we could do better than that.

AUTHOR

Top

Berik Visschers <berikv@xs4all.nl>

COPYRIGHT

Top


Data-Page-Set documentation  | view source Contained in the Data-Page-Set distribution.