[Dancer-users] How do I share variables between route handlers ?

Takeshi OKURA okura3 at gmail.com
Sat Apr 16 12:26:08 CEST 2011


2011/4/15 Takeshi OKURA <okura3 at gmail.com>:

> Waht better way to share variables in route handlers ?

ambs said in thread "Bug in `forward`? "
2011/4/16 ambs <ambs+dancer at perl-hackers.net>:
> get '/ticket/:tid/assign' => sub {
>   my $tid = params->{tid};
>   params->{assign} = 1;
>   return forward "/ticket/$tid/set";
> };

I noticed that params can be used to share variables between route handlers.

If I do not have any other good way, I want to use a one params
variable for share variables.

for example.
 params->{_stash}->{foo}, params->{_stash}->{bar} etc.

Regard.

-- 
Takeshi OKURA


More information about the Dancer-users mailing list