[dancer-users] get session info without route

Stefan Hornburg (Racke) racke at linuxia.de
Tue Sep 10 15:25:39 BST 2013


On 09/10/2013 04:16 PM, Hugues Max wrote:
> In fact a search a solution to DO NOT repeat in my code something like
>
> my $PATHXLS  = config->{'PATHXLS'}.session 'numclient'
> for each route
>
>
> for the moment
> in:
> get '/outils' => sub {
> I add:         my $PATHXLS  = config->{'PATHXLS'}.session 'numclient'
>
> post '/outils' => sub {
> I add:         my $PATHXLS  = config->{'PATHXLS'}.session 'numclient'
>
> if I have 10 sessions setting, I need to add 10 lines per route
> etc...
> what is the solution ?

Adding your session settings to vars in "before" hook and using these
vars in routes should work.

Regards
            Racke


-- 
Perl and Dancer Development

Visit our Open Source conference on E-commerce:

http://www.ecommerce-innovation.com/


More information about the dancer-users mailing list