http://www.perlmonks.org?node_id=1227221


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 );