[dancer-users] Managing session in before hook

Cymon cymon.ML at gmail.com
Tue Jun 18 23:12:42 BST 2013


Hi all,

what is the right way to manage session in a before hook?
I need to write a session key during the before hook execution, to
retrieve it in dispatcher (to render the value).
I tried many ways like:

hook before => sub {
    my $context = shift;
...

session 'foo' => 'bar';

$context->app->session->{'foo'} = 'bar';

$session = $context->session;
$session->write('foo', 'bar')

}


but everytime nothing arrives to the dispatcher and nothing is actually
written (I used Session::YAML to test this).

Where am I wrong?


-- 
Cymon
Coniglio domina,
http://www.therabbit.it


More information about the dancer-users mailing list