[Catalyst] little syntax
Peter Karman
peter at peknet.com
Thu Apr 12 18:02:32 GMT 2007
Will Smith scribbled on 4/12/07 11:43 AM:
> I have the following piece of code:
>
> # in controller
> ...
> while ( my $row = $file->read ) {
> push @record, {
> id => $row->{id},
> name => $row->{name},
> };
> }
> $c->stash->{recs} = @records;
> .....
>
> What is the syntax on the tt2 to access the id and name?
> Or please point me to somewhere that I could do some reading on the question.
>
you want:
$c->stash->{recs} = \@records;
and then in tt:
[% FOR rec IN recs;
rec.id;
rec.name;
END %]
--
Peter Karman . http://peknet.com/ . peter at peknet.com
More information about the Catalyst
mailing list