On 13/03/07, Octavian Rasnita <[EMAIL PROTECTED]> wrote:
Hi,

I have a DBIC record object like
my $obj = $c->model("Database::Table")->find($id);

The table has very many fields and I would like to put their values in a TT
template without inserting them one by one in the stash.

So I would like to create a hash ref from $obj where the name of the field
is the key and the value from the table is the value in that hash, then use
$c->stash($hashref).

Is it possible to create that hash (ref) from $obj, or I need to do
something like

$c->stash->{obj} = $obj;

and in the template use [% obj.name1 %]... [% obj.name2 %]?

And by the way, which do you think is the recommended way?

I'd have thought the second one. $obj is essentially just a hash, so
I'm not sure what you'd stand to gain using the first method.

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to