<div dir="ltr">Is it possible to pass the 'session' hash to a subroutine and set it in there? This is something I did in Dancer2 for setting some sessions..</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Sep 10, 2013 at 4:16 PM, Hugues Max <span dir="ltr"><<a href="mailto:huguesmax@gmail.com" target="_blank">huguesmax@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In fact a search a solution to DO NOT repeat in my code something like<div class="im"><br>
<br>
my $PATHXLS = config->{'PATHXLS'}.session 'numclient'<br></div>
for each route<br>
<br>
<br>
for the moment<br>
in:<br>
get '/outils' => sub {<br>
I add: my $PATHXLS = config->{'PATHXLS'}.session 'numclient'<br>
<br>
post '/outils' => sub {<br>
I add: my $PATHXLS = config->{'PATHXLS'}.session 'numclient'<br>
<br>
if I have 10 sessions setting, I need to add 10 lines per route<br>
etc...<br>
what is the solution ?<br>
<br>
<br>
<br>
Le 10/09/2013 16:08, Stefan Hornburg (Racke) a écrit :<div class="im HOEnZb"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 09/10/2013 04:05 PM, Hugues Max wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Please see my hook ( here numclient = 366 )<br>
<br>
<br>
hook 'before' => sub {<br>
var numclient => session 'numclient';<br>
debug "session numclient ". session 'numclient';;<br>
debug "vars in hook ".vars->{'numclient'};<br>
};<br>
<br>
debug "vars out hook" . vars->{'numclient'};<br>
<br>
<br>
<br>
and log<br>
<br>
[8425] debug @0.004796> [hit #1]session numclient 366 in /home/faxexpert/DancerFx/lib/<u></u>fx/<a href="http://outils.pm" target="_blank">outils.pm</a> l. 25<br>
[8425] debug @0.004964> [hit #1]vars in hook 366 in /home/faxexpert/DancerFx/lib/<u></u>fx/<a href="http://outils.pm" target="_blank">outils.pm</a> l. 26<br>
[8425] core @0.005126> [hit #1]entering before hook in /usr/local/share/perl5/Dancer/<u></u>Hook.pm l. 58<br>
[8425] core @0.090481> [hit #1]response: 200 in /usr/local/share/perl5/Dancer/<u></u>Handler.pm l. 179<br>
[8426] debug @0.000009> vars out hook in /home/faxexpert/DancerFx/lib/<u></u>fx/<a href="http://outils.pm" target="_blank">outils.pm</a> l. 29<br>
<br>
vars out hook is empty...<br>
<br>
</blockquote>
<br>
Do you really use<br>
<br>
debug "vars out hook" . vars->{'numclient'};<br>
<br>
outside a route?<br>
<br>
In this case, vars isn't populated as you don't have a current request.<br>
<br>
Regards<br>
Racke<br>
<br>
</blockquote>
<br></div><div class="HOEnZb"><div class="h5">
______________________________<u></u>_________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/<u></u>mailman/listinfo/dancer-users</a><br>
</div></div></blockquote></div><br></div>