Array::Window

Calculate windows/subsets/pages of arrays
Download

Array::Window Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Adam Kennedy
  • Publisher web site:
  • http://search.cpan.org/~adamk/

Array::Window Tags


Array::Window Description

Calculate windows/subsets/pages of arrays Many applications require that a large set of results be broken down into a smaller set of 'windows', or 'pages' in web language. Array::Window is a Perl module that implements an algorithm specifically for dealing with these windows. It is very flexible and permissive, making adjustments to the window as needed.Note that this is NOT under Math:: for a reason. It doesn't implement in a pure fashion, it handles idiosyncracies and corner cases specifically relating to the presentation of data.SYNOPSIS # Your search routine returns an reference to an array # of sorted results of unknown quantity. my $results = SomeSearch->find( 'blah' ); # We want to display 20 results at a time my $window = Array::Window->new( source => $results, window_start => 0, window_length => 20, ); # Do we need to split into pages at all? my $show_pages = $window->required; # Extract the subset from the array my $subset = $window->extract( $results ); # Are there 'first', 'last', 'next' or 'previous' windows? my $first = $window->first; my $last = $window->last; my $next = $window->next; my $previous = $window->previous; Requirements: · Perl


Array::Window Related Software