Subject: | Broken if last page contains single row |
Hi,
I was trying to use the Template::Plugin::page module version 0.10. I
have noticed a bug
If the last page of paginated data contains only one data element then
the last page output is messed up. For eg run the attached perl file
this way
$ perl bug.txt 1 ( this displays 1st page ) .. works fine
$ perl bug.txt 2 ( output is messed up )
#!/usr/bin/perl
#
use strict;
use warnings;
use Template;
my(%tag, $i, @data );
for( 'a' .. 'z' ) {
push @data, { letter => $_, number => ++ $i };
}
$tag{data}=\@data;
$tag{pageno}=int $ARGV[0] || 1;
my $tt = Template->new;
$tt->process( \*DATA, \%tag);
__DATA__
[% USE page = Page( data.size, 25, pageno) %]
[% results = page.splice( data ) %]
Showing page number [% pageno %] of [% page.last_page %]
[% FOREACH item IN results %]
letter: [% item.letter %] ----- number [% item.number %]
[% END %]