Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Mojolicious global variable

by trippledubs (Deacon)
on Dec 13, 2018 at 20:19 UTC ( #1227221=note: print w/replies, xml ) Need Help??


in reply to Mojolicious global variable

If you're using a variable across more than one route, but not globally across the whole application, it needs to go into a user cookie or saved per session. You currently have one global across the whole app.
# Validate $c->param('router') $c->session->{$router} = $c->param('router'); # In other routes my $router = $c->session->{$router} // $c->stash( router => $GLOBAL_DE +FAULT_ROUTER );

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1227221]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2020-10-30 18:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (282 votes). Check out past polls.

    Notices?