2 use Plack::Middleware::Session;
4 use HTTP::Request::Common;
8 package My::Custom::Session;
11 use parent 'Plack::Session';
17 isa_ok($env->{'plack.session'}, 'My::Custom::Session');
19 my $counter = $env->{'plack.session'}->get('counter') || 0;
21 my $body = "Counter=$counter";
23 $env->{'plack.session'}->set(counter => $counter);
25 return [ 200, [], [ $body ] ];
28 $app = Plack::Middleware::Session->wrap(
30 session_class => 'My::Custom::Session'
36 my $jar = HTTP::Cookies->new;
38 my $res = $cb->(GET "http://localhost/");
39 is $res->content, "Counter=0";
40 $jar->extract_cookies($res);
42 my $req = GET "http://localhost/";
43 $jar->add_cookie_header($req);
45 is $res->content, "Counter=1";