[Catalyst] putting an object in the stash

Simon Wilcox simonw at digitalcraftsmen.net
Tue Mar 13 12:33:51 GMT 2007


On Tue, 13 Mar 2007, Octavian Rasnita wrote:

> That's why I want to find how to put the key/values from $obj into a common
> hash.

It sounds like this might be a bad design decision. Why would you not want
to group your template variables ?

As your app grows you'd be much more likely to see one key trample on
another from a different object.

> 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->$_;
> }

Yes, see my earlier post. You can get the columns from the ResultSet
object.

S.

-- 
Digital Craftsmen Ltd
Exmouth House, 3 Pine Street, London. EC1R 0JH
t 020 7183 1410 f 020 7099 5140 m 07951 758698
w http://www.digitalcraftsmen.net/



More information about the Catalyst mailing list