| Data-Page-Tied documentation | view source | Contained in the Data-Page-Tied distribution. |
Data::Page::Tied - Tied interface for the Data::Page module
use Data::Page::Tied;
$handler = tie @data,
'Data::Page::Tied',
[qw(some data to start with)],
$entries_per_page,
$current_page;
push @data, @more_data;
print "first entry on page ", $handler->current_page(),
" is ", $handler->first();
This module depends on Data::Page and Test::Simple.
The Data::Page::Tied module adds a tied interface to the
object-oriented interface defined by Leon Brocard's
Data::Page module. It also adds several methods to set
and get the current page and the number of data items per
page.
Please read Data::Page as Data::Page::Tied inherits
all methods from Data::Page.
The tying constructor has the following syntax:
tie @ary, 'Data::Page::Tied', ARRAYREF,
INTEGER, INTEGER;
Where the referenced array may contain any data to start with and the integers denote the number of entries per page and the current page respectively.
This is the constructor. It is invoked by the tied interface, but using it directly allows for two distinct ways of creating new objects:
You may use the same syntax as the tied interface or you may
use the following syntax to get an ordinary Data::Page object
instead of a Data::Page::Tied object:
Data::Page::Tied->new( INTEGER, @args );
Where the integer is the number of elements.
This method returns the number of items in the tied array.
This method sets the current page. You may find the current page
by using the inherited current_page method.
This method sets the number of items displayed per page. You may
find the current number of items displayed per page
by using the inherited entries_per_page method.
This accessor is used to get or set any specific entry. It takes
one or two arguments. The first argument is always the array index
and the second (optional) argument is the value you want to set
$array[$index] to.
Additional method to make the interface more consistent. Takes two arguments. See entry.
Steffen Mueller, <smueller@cpan.org>
Copyright (C) 2002-2006 Steffen Mueller
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
| Data-Page-Tied documentation | view source | Contained in the Data-Page-Tied distribution. |