Main > Programming > Libraries >

Data::Page::Viewport 1.02

Data::Page::Viewport 1.02

Sponsored Links

Data::Page::Viewport 1.02 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.008 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 1118
Date added: 2006-10-03
Publisher: Ron Savage

Data::Page::Viewport 1.02 description

Data::Page::Viewport is a Perl module to scroll thru data a page, or just an item, at a time.

Synopsis

This is a complete, tested, runnable program.
#!/usr/bin/perl

use strict;
use warnings;

use Data::Page::Viewport;

# -----------------------------------------------

my(@data) = (qw/zero one two three four five six
seven eight nine ten eleven twelve thirteen fourteen/);
my($page) = Data::Page::Viewport -> new
(
data_size => scalar @data,
page_size => 4
);

print "Data bounds: 0 .. $#data. n";
print "Data: ", join(, , @data), ". n";
print "Page bounds: 0 .. 3. n";
print "Page data: ", join(, , @data[0 .. 3]), ". n";
print "n";

my(@bound);

for (-2, 1, 4, 4, 1, 3, 3, -2, 1, 2, 1, -4, -4,
-1, 1, 2, -1, -2, -2, -1, -4, 4, 4, 4)
{
print "Offset: $_. n";

@bound = $page -> offset($_) -> bounds();

print "Page bounds: $bound[0] .. $bound[1]. n";
print Page data: ,
join(, , @data[$bound[0] .. $bound[1] ]),
". n";
print - x 50, "n";
}

Data::Page::Viewport is a pure Perl module.

This module keeps track of what items are on the current page, when you scroll forwards or backwards within a data set.

Similarly to Data::Page, you can call sub offset(N), for + or - N, to scroll thru the data a page at a time.

And, like Set::Window, you can call sub offset(N), for + or - 1, to scroll thru the data an item at a time.

Clearly, N does not have to be fixed.

The viewport provides access to the current page, and the code shifts indexes into and out of the viewport, according to the parameter passed to sub offset().

Note that the data is not passed into this module. The module only keeps track of the indexes within the viewport, i.e. indexes on the current page.

You call sub bounds() on the object (of type Set::Window) returned by sub offset(), to determine what indexes are on the current page at any particular point in time.

Also note that, unlike Set::Window, the boundaries of the viewport are rigid, so that changes to the indexes caused by sub offset() are limited by the size of the data set.

This means, if you do this:

my($page) = Data::Page::Viewport -> new
(
data_size => $#data, # 0 .. $#data.
page_size => $page_size, # 1 .. N.
);

my(@bound) = $page -> offset(- 1) -> bounds();

the call to sub offset(- 1) will have no effect.

That is, when trying to go back past the beginning of the data set, the bounds will be locked to values within 0 .. data_size.

Similarly, a call which would go beyond the other end of the data set, will lock the bounds to the same range.

In short, you cant fall off the edge by calling sub offset().

This in turn means that the values returned by sub bounds() will always be valid indexes within the range 0 .. data_size.

The module implements this by building 2 objects of type Set::Window, one for the original data set (which never changes), and one for the current page, which changes each time sub offset() is called (until the boundaries are hit, of course).

Note: No range checking is performed on the parameters to sub new().

Note: It should be obvious by now that this module differs from Data::Page, and indeed all such modules, in that they never change the items which are on a given page. They only allow you to change the page known as the current page. This module differs, in that, by calling sub offset(+ or - N), you are effectively changing the items which are deemed to be on the current page.

Data::Page::Viewport 1.02 Screenshot

Advertisements

Data::Page::Viewport 1.02 Keywords

Bookmark Data::Page::Viewport 1.02

Hyperlink code:
Link for forum:

Data::Page::Viewport 1.02 Copyright

WareSeeker periodically updates pricing and software information of Data::Page::Viewport 1.02 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Data::Page::Viewport 1.02 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Data::Page is a Perl module that helps when paging through sets of results. Free Download
The Data Mine is a search engine designed to give users an unusually powerful interface. Free Download
Data::SpreadPagination is a Perl module for page numbering and spread pagination. Free Download
Data::Region Perl module can define hierarchical areas with behaviors. Free Download
Class::InsideOut is a Perl module with a safe, simple inside-out object construction kit. Free Download
App::Manager is a Perl module for installing, managing and uninstalling software packages. Free Download
App::Modular is a Perl module with modularization framework for perl programs. Free Download
Acme::Comment is a Perl module that allows multi-line comments which are filtered out. Free Download