11 use Plack::Session::State;
12 use Plack::Session::Store::Null;
13 use Plack::Middleware::Session;
15 my $storage = Plack::Session::Store::Null->new;
16 my $state = Plack::Session::State->new;
17 my $m = Plack::Middleware::Session->new(store => $storage, state => $state);
18 my $request_creator = sub {
19 open my $in, '<', \do { my $d };
21 'psgi.version' => [ 1, 0 ],
23 'psgi.errors' => *STDERR,
24 'psgi.url_scheme' => 'http',
26 REQUEST_METHOD => 'GET',
28 my $r = Plack::Request->new( $env );
34 my $r = $request_creator->();
36 my $s = Plack::Session->fetch_or_create($r, $m);
38 ok($s->id, '... got a session id');
40 ok(!$s->get('foo'), '... no value stored in foo for session');
43 $s->set( foo => 'bar' );
44 } '... set the value successfully in session';
46 is($s->get('foo'), 'bar', 'No store, but session works in the session lifetime');
50 } '... removed the value successfully in session';
54 } '... expire session successfully';
56 my $resp = $r->new_response;
59 $s->finalize( $m, $resp );
60 } '... finalized session successfully';