[dancer-users] get session info without route

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


On 09/10/2013 04:05 PM, Hugues Max wrote:
> Please see my hook ( here numclient = 366 )
>
>
> hook 'before' => sub {
>       var numclient => session 'numclient';
>      debug "session numclient ". session 'numclient';;
>      debug "vars in hook ".vars->{'numclient'};
> };
>
> debug "vars out hook" . vars->{'numclient'};
>
>
>
> and log
>
> [8425] debug @0.004796> [hit #1]session numclient 366 in /home/faxexpert/DancerFx/lib/fx/outils.pm l. 25
> [8425] debug @0.004964> [hit #1]vars in hook 366 in /home/faxexpert/DancerFx/lib/fx/outils.pm l. 26
> [8425]  core @0.005126> [hit #1]entering before hook in /usr/local/share/perl5/Dancer/Hook.pm l. 58
> [8425]  core @0.090481> [hit #1]response: 200 in /usr/local/share/perl5/Dancer/Handler.pm l. 179
> [8426] debug @0.000009> vars out hook in /home/faxexpert/DancerFx/lib/fx/outils.pm l. 29
>
> vars out hook is empty...
>

Do you really use

debug "vars out hook" . vars->{'numclient'};

outside a route?

In this case, vars isn't populated as you don't have a current request.

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