[Catalyst] assigning vars to $c->stash

Jonathan Rockway jon at jrock.us
Mon Mar 12 11:39:09 GMT 2007


On Monday 12 March 2007 06:31, Octavian Rasnita wrote:
> Hi,
>
> I have a $hash hash reference and I want to add all its elements to the
> stash. How can I do this? Do I need to use a loop and assign each element
> one by one?
>
> I have seen that it is not possible to use $c->stash = $hash;
>
> Can I use something else than
>
> foreach(keys %$hash) {
> $c->stash->{$_} = $hash->{$_};
> }

$c->stash( { %{$c->stash||{}}, %hash } ); 

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070312/d57490f7/attachment.pgp


More information about the Catalyst mailing list