Re: [Templates] Array of hashes or hash refs

[prev] [thread] [next] [Date index for 2004/09/24]

From: Roderick A. Anderson
Subject: Re: [Templates] Array of hashes or hash refs
Date: 19:43 on 24 Sep 2004
On Fri, 24 Sep 2004, Harald Joerg wrote:

> > 	{ LastName => Smith, FirstName => John, ID => BR549 }
> 
> Note that you may omit quotes on hash keys, but not on values.

Yeah I let math and perl get mixed together here.  I use the => when I 
want to convey to others that is isn't really equal but implies.  I let it 
slip through while typing too quickly.

>     %CSI = (ToDay => 'Sep 23, 2004'; PageTitle => 'Not doing so well');
>     @array = ([ LastName => 'Smith',    FirstName => 'John', ID => 'BR549' ]
>              ,[ LastName => 'Anderson', FirstName => 'Rod',  ID => 'BR007' ]
>              );
> 
>     $sut->process($filename
>                  ,{'CSI'       => \%CSI
>                   ,'array'     => \@array
>                   }
>                  );
> 
> ...and in your template you can have things like:
> 
> At [% CSI.ToDay %] [% array.0.FirstName %] [% array.0.LastName %] was
>    [% CSI.PageTitle %].

Gotcha!


Rod
        -- 
            "Open Source Software - You usually get more than you pay for..."
     "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL"



_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Array of hashes or hash refs
Roderick A. Anderson 23:39 on 23 Sep 2004

Re: [Templates] Array of hashes or hash refs
Axel Gerstmair 09:25 on 24 Sep 2004

Re: [Templates] Array of hashes or hash refs
Harald Joerg 09:54 on 24 Sep 2004

Re: [Templates] Array of hashes or hash refs
merlyn (Randal L. Schwartz) 12:09 on 24 Sep 2004

Re: [Templates] Array of hashes or hash refs
Harald Joerg 21:59 on 24 Sep 2004

Re: [Templates] Array of hashes or hash refs
Roderick A. Anderson 19:43 on 24 Sep 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52