Dancer::Session::PSGI - Let Plack::Middleware::Session handle Dancer's session
version 0.01
A basic psgi application
use strict; use warnings; use Plack::Builder; my $app = sub { my $session = (shift)->{'psgix.session'}; return [ 200, [ 'Content-Type' => 'text/plain' ], [ "Hello, you've been here for ", $session->{counter}++, "th time!" ], ]; }; builder { enable 'Session', store => 'File'; $app; };
In your app.psgi:
builder { enable "Session", store => "File"; sub { my $env = shift; my $request = Dancer::Request->new($env); Dancer->dance($request);}; };
And a simple Dancer application:
package session; use Dancer ':syntax'; get '/' => sub { my $count = session("counter"); session "counter" => ++$count; template 'index', {count => $count}; };
Now, your two applications can share the same session informations.
Dancer::Session::PSGI let you use Plack::Middleware::Session as backend for your sessions.
Plack::Middleware::Session
franck cuny <franck@lumberjaph.net>
This software is copyright (c) 2010 by franck cuny.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Dancer::Session::PSGI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Session::PSGI
CPAN shell
perl -MCPAN -e shell install Dancer::Session::PSGI
For more information on module installation, please visit the detailed CPAN module installation guide.