Skip Menu |

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

Report information
The Basics
Id: 8951
Status: open
Priority: 0/
Queue: Template-Plugin-Pagination

People
Owner: Nobody in particular
Requestors: chris [...] paymentonline.com
Cc:
AdminCc:

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



Subject: hash ref turns into array when only one item to display
When the list passed to Pagination is a list of hash ref's, and when page.page_data should contain just one array element (a single hash ref), instead it contains an array of all the keys and values of the hash. This also happens if the list itself that is passed to Pagination is a single hash ref. This is with perl 5.6.1 on freebsd 5.3, the latest template toolkit, and the latest (as of last week) versions of all the pagination modules required by template::plugin::pagination. Chris
Date: Fri, 17 Dec 2004 18:41:25 +0000
From: Tony Bowden <tony [...] kasei.com>
To: Guest via RT <bug-Template-Plugin-Pagination [...] rt.cpan.org>
Subject: Re: [cpan #8951] hash ref turns into array when only one item to display
RT-Send-Cc:
On Thu, Dec 16, 2004 at 01:31:23PM -0500, Guest via RT wrote: Show quoted text
> When the list passed to Pagination is a list of hash ref's, and when > page.page_data should contain just one array element (a single hash ref), > instead it contains an array of all the keys and values of the hash. > This also happens if the list itself that is passed to Pagination is a > single hash ref.
Can you supply a test script? Tony
From: chris [...] paymentonline.com
[tony@kasei.com - Fri Dec 17 14:05:05 2004]: Show quoted text
> On Thu, Dec 16, 2004 at 01:31:23PM -0500, Guest via RT wrote:
> > When the list passed to Pagination is a list of hash ref's, and
when Show quoted text
> > page.page_data should contain just one array element (a single
hash ref), Show quoted text
> > instead it contains an array of all the keys and values of the
hash. Show quoted text
> > This also happens if the list itself that is passed to Pagination
is a Show quoted text
> > single hash ref.
> > Can you supply a test script? > > Tony
I replied to the email but it doesn't look like it posted here correctly so here it is again.... This is a template toolkit template page. ----------------------------------- [% IF params.pagenum < 1 %] [% params.pagenum = 1 %] [% END %] [% list = [] %] [% USE DBI %] [% FOREACH item = DBI.query( "SELECT * FROM poi2_products" ) %] [% list.push(item) %] [% END %] [% USE page = Pagination(list, params.pagenum, 20) %] [% FOREACH item IN page.page_data.sort %] [% item.sku %]<BR> [% END %] [% UNLESS params.pagenum == 1 %] <a href="[%params.catalog_url%]/page.html?pagenum=[% page.first_page %]">First</a> &nbsp;&nbsp; <a href="[%params.catalog_url%]/page.html?pagenum=[% page.previous_page %]">Previous</a> &nbsp;&nbsp; [% END %] [% UNLESS params.pagenum >= page.last_page %] <a href="[%params.catalog_url%]/page.html?pagenum=[% page.next_page %]">Next</a> &nbsp;&nbsp; <a href="[%params.catalog_url%]/page.html?pagenum=[% page.last_page %]">Last</a> [% END %] <BR><BR> Entries [%page.first%] - [%page.last%] of [%page.total_entries%]<BR> First page: [% page.first_page %] Prev page: [% page.previous_page %] Current page: [% page.current_page %] Next page: [% page.next_page %] Last page: [% page.last_page %]
Date: Sat, 18 Dec 2004 12:24:28 +0000
From: Tony Bowden <tony [...] kasei.com>
To: Guest via RT <bug-Template-Plugin-Pagination [...] rt.cpan.org>
Subject: Re: [cpan #8951] hash ref turns into array when only one item to display
RT-Send-Cc:
On Fri, Dec 17, 2004 at 08:55:20PM -0500, Guest via RT wrote: Show quoted text
> > Can you supply a test script?
> I replied to the email but it doesn't look like it posted here > correctly so here it is again.... This is a template toolkit template > page.
I'll need something selfcontained that I can actually run to show the problem... Tony
[tony@kasei.com - Sat Dec 18 07:28:08 2004]: Show quoted text
> On Fri, Dec 17, 2004 at 08:55:20PM -0500, Guest via RT wrote:
> > > Can you supply a test script?
> > I replied to the email but it doesn't look like it posted here > > correctly so here it is again.... This is a template toolkit
template Show quoted text
> > page.
> > I'll need something selfcontained that I can actually run to show the > problem... > > Tony
Here is something that will work as is. [% hash1.a = '1A' hash1.b = '1B' hash1.c = '1C' %] [% hash2.a = '2A' hash2.b = '2B' hash2.c = '2C' %] [% list = [] %] [% list.push(hash1) %] [% USE page = Pagination(list, 1, 20) %] [% FOREACH item IN page.page_data.sort %] [%# Doesn't work. item = literal a,b,c %] a = [% item.a %]<BR> b = [% item.b %]<BR> c = [% item.c %]<BR> [% END %] <BR><BR> [% list = [] %] [% list.push(hash1) %] [% list.push(hash2) %] [% USE page = Pagination(list, 1, 20) %] [% FOREACH item IN page.page_data.sort %] [%# Does work %] a = [% item.a %]<BR> b = [% item.b %]<BR> c = [% item.c %]<BR> [% END %]
From: Mel Harbour
I've fixed this bug and have submitted the patched version of the module to Tony for uploading.
From: explorer [...] joaquinferrero.com
El Lun Jul 03 09:10:23 2006, guest escribió: Show quoted text
> I've fixed this bug and have submitted the patched version of the module > to Tony for uploading.
Can you to publish here the patch? Tony not respond...