Skip Menu |

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

Report information
The Basics
Id: 73896
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: tom [...] eborcom.com
Cc:
AdminCc:

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



The attached failing test case demonstrates a problem sorting a list that contains one hash reference. If you uncomment the additional hash reference, the list contains two elements and the test passes. This problem only occurs with a one element list. I hope this provides enough information to diagnose the bug. Thanks for all your great work on Template Toolkit. Tom
Subject: onesort.t
#!perl use strict; use warnings; package Foo; sub new { return bless {}, shift; } sub all { return ( { name => 'apple', colour => 'green', }, #{ # name => 'banana', # colour => 'yellow', #}, ) } package main; use Test::More tests => 1; use Template (); my $template = Template->new(); my $output; $template->process(\*DATA, { foo => Foo->new() }, \$output) or die $template->error; like $output, qr/\bapple\b/; __DATA__ [% FOREACH p IN foo.all.sort('name') -%] A [% p.name %] is [% p.colour %] [% END -%]
Ticket migrated to github as https://github.com/abw/Template2/issues/108