[Catalyst] assigning vars to $c->stash
Carl Franks
fireartist at gmail.com
Mon Mar 12 11:39:11 GMT 2007
On 12/03/07, Octavian Rasnita <orasnita at gmail.com> 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;
%{ $c->stash } = ( %{ $c->stash }, %$hash );
would also work, which combines both hashes.
This is very much a perl references problem - not something cat-specific.
See `perldoc perlref` for more info.
Cheers,
Carl
More information about the Catalyst
mailing list