Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Template, sorting an array with only one member

by Anonymous Monk
on Oct 20, 2014 at 11:05 UTC ( [id://1104415]=note: print w/replies, xml ) Need Help??


in reply to Re: Template, sorting an array with only one member (code not words)
in thread Template, sorting an array with only one member

You must be giving it a hash instead of an array ... don't know how you managed to write that :)

[% MACRO blocker BLOCK %] [% FOREACH element IN array.sort('name') %] [% element.name %] [%- END -%] [%- END -%] [%- SET array = [ { name => 'foo', value => 1 }, { name => 'bar', value => 2 }, { name => 'baz', value => 3 } ]; blocker; %] [%- SET array = [ { name => 'bar', value => 2 }, ]; blocker; %] [%- ## A HASH IS NOT AN ARRAY OF HASHES SET array = { name => 'bar', value => 2 }; blocker; %]

yadayadayada

* bar * baz * foo * bar * *

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1104415]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-24 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found