[Catalyst] assigning vars to $c->stash
Robert 'phaylon' Sedlacek
rs at 474.at
Mon Mar 12 12:21:24 GMT 2007
Octavian Rasnita wrote:
> 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->{$_};
> }
Just
$c->stash( %$hash );
should do it, iirc.
--
# Robert 'phaylon' Sedlacek
# Perl 5/Catalyst Developer in Hamburg, Germany
{ EMail => ' rs at 474.at ', Web => ' http://474.at ' }
More information about the Catalyst
mailing list