NAME

Dancer::Session::PSGI - Let Plack::Middleware::Session handle Dancer's session

VERSION

version 0.02

SYNOPSIS

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.

DESCRIPTION

Dancer::Session::PSGI let you use Plack::Middleware::Session as backend for your sessions.

MAINTAINER

Dancer Core Team

AUTHOR

franck cuny <franck@lumberjaph.net>

COPYRIGHT AND LICENSE

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.