[Catalyst] putting an object in the stash
Carl Johnstone
catalyst at fadetoblack.me.uk
Tue Mar 13 12:56:00 GMT 2007
> Is it possible to do that without specifying all the keys by name? Or at
> least is there a way to get all the keys from $obj, then loop and create a
> hash, something like:
>
> my $hash;
> foreach(@keys) {
> $hash->{$_} = $obj->$_;
> }
You're asking for trouble with something like that. Create a DB column
called "template" and BOOM!
You're almost certainly better off doing this on the template side of
things:
[% FOREACH obj %]
Name: [% name %]
[% END %]
Will do the same as:
Name: [% obj.name %]
as long as there is only one obj.
Carl
More information about the Catalyst
mailing list