Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: jraspass [...] gmail.com
Cc:
AdminCc:

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



Subject: Methods returning single element lists of hashrefs are broken.
Take the following program, the sub passed in to Template::Toolkit returns a list containing one hashref. All the calls to this sub are reporting just the hashref, ignoring the list. A hack showing the expected output is at the bottom by abusing a matching all grep, a double reverse would also suffice. #!/usr/bin/env perl use strict; use warnings; use Template; sub sub { my @array = {qw/foo bar baz qux/}; return @array; } Template->new->process(\<<'EOF', { sub => \&sub } ); [% sub %] [% sub.size %] [% FOR val IN sub %] [% val %] [% END %] [% FOR val IN sub.grep('') %] [% val %] [% END %] EOF
This looks similar to https://rt.cpan.org/Ticket/Display.html?id=73896 which also includes a failing test case.
Ticket migrated to github as https://github.com/abw/Template2/issues/166