Data::Paginated module is used in Template::Plugin::Pagination, which is
a pagination plugin widely used by many. I have noticed an unexpected
behavior. To replicate the issue, I have attached a sample script and
template. I have Data::Paginated v1.01 and Template::Plugin::Pagination
v0.90 running on Perl v5.8.8 built for MSWin32-x86-multi-thread.
Show quoted text
>perl test.pl
Having patched the method page_data() in the module Data::Paginated
something like below:
sub page_data {
my $self = shift;
my @data = @{ $self->{__DATA_PAGINATED_ENTRIES} } [ $self->first - 1 ..
$self->last - 1 ];
return \@data;
}
Then if we run the test script, I get the expected result:
Show quoted text> perl test.pl
A A1
Am I making any sense to you?
Best Regards,
Mohammad S Anwar
Subject: | test.tt |
Message body not shown because it is not plain text.
Subject: | test.pl |
#!perl
use Template;
use Data::Paginated;
my $list = [{ name => 'A1', type => 'A'} ];
my $page = Data::Paginated->new({
entries => $list,
entries_per_page => 5,
current_page => 1,
});
my $tt = Template->new;
$tt->process('test.tt', { pages => $page->page_data }) || die $tt->error;