[Catalyst] Sort something in the stash

Chisel Wright chisel at herlpacker.co.uk
Wed Jun 7 15:25:00 CEST 2006


On Wed, Jun 07, 2006 at 02:16:53PM +0100, Chisel Wright wrote:
> On Wed, Jun 07, 2006 at 08:04:10AM -0500, Ryan wrote:
> > Something like that...and I want to be able to sort on say 'name' in that
> > structure. Anyone know an easy way to sort by an array of hashes on a key?
> 
> "perldoc -q sort" any help?

Sorry, misread the post, and missed the bit about doing in in Template.


I've used stuff like:

  [% FOREACH model = models.sort('name') %]
  ...
  [% END %]

on a structure created as:

  [% models = [
	{
		name  => 'Person',
		image => 'URL',
    },
	...
  %]

before - not sure if that's any help

Chisel
-- 
Chisel Wright
e: chisel at herlpacker.co.uk
w: http://www.herlpacker.co.uk/

This is not an automated signature. I type this in to the bottom of every
message. 



More information about the Catalyst mailing list