2 use Plack::Middleware::Session;
4 use HTTP::Request::Common;
9 my $counter = $env->{'plack.session'}->get('counter') || 0;
11 my $body = "Counter=$counter";
13 $env->{'plack.session'}->set(counter => $counter);
15 return [ 200, [], [ $body ] ];
18 $app = Plack::Middleware::Session->wrap($app);
23 my $jar = HTTP::Cookies->new;
25 my $res = $cb->(GET "http://localhost/");
26 is $res->content, "Counter=0";
27 $jar->extract_cookies($res);
29 my $req = GET "http://localhost/";
30 $jar->add_cookie_header($req);
32 is $res->content, "Counter=1";