Il giorno Tue, 18 Jun 2013 19:15:37 -0400 David Golden <[email protected]> ha scritto:
> On Tue, Jun 18, 2013 at 6:12 PM, Cymon <[email protected]> wrote: > > what is the right way to manage session in a before hook? > > You need to give us more details and sample code. Where is your > before hook? In your application? Or in a plugin? What are you > doing in your dispatcher? > > FWIW, sessions aren't flushed (e.g. to disk) until an after hook, so > when you say "nothing is written", when are you checking? > > David > > -- > David Golden <[email protected]> > Take back your inbox! → http://www.bunchmail.com/ > Twitter/IRC: @xdg > _______________________________________________ > dancer-users mailing list > [email protected] > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users I give you a little not working example. In the main package of the Dancer2 project I have: package project; use Dancer2 ':syntax'; use Dancer2::Template::TemplateToolkit; hook before => sub { my $context = shift; my $newpath = '/there'; //this or any other of the ones I said $context->app->session->{'foo'} = 'bar'; //I tried also to turn off forwording with no effect $context->response( forward($newpath )); $context->response->halt; }; then in the dispatcher: get '/there' => sub { print session('foo'); //nothing in it template 'index'; }; I checked the YAML file using Session::YAML after navigation. They're all empty. -- Cymon Coniglio domina, http://www.therabbit.it _______________________________________________ dancer-users mailing list [email protected] http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
