Skip Menu |

This queue is for tickets about the Template-Plugin-Page CPAN distribution.

Report information
The Basics
Id: 12476
Status: open
Priority: 0/
Queue: Template-Plugin-Page

People
Owner: Nobody in particular
Requestors: ram [...] netcore.co.in
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



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 %]
From: ianburrell [...] gmail.com
I have the same problem with a repot with a single row. The splice method in the underlying Data::Page works correctly.