Remove $session->commit, and hence remove manager to make Session
Tatsuhiko Miyagawa [Sat, 9 Jan 2010 19:44:01 +0000 (11:44 -0800)]
object really stateless.

lib/Plack/Middleware/Session.pm
lib/Plack/Session.pm

index 7440a01..15c4d6e 100644 (file)
@@ -58,7 +58,7 @@ sub call {
     $env->{'psgix.session.options'} = { id => $id };
 
     if ($self->session_class) {
-        $env->{'plack.session'} = $self->session_class->new($env, $self);
+        $env->{'plack.session'} = $self->session_class->new($env);
     }
 
     my $res = $self->app->($env);
index 17a7a3a..b86c625 100644 (file)
@@ -5,12 +5,11 @@ use warnings;
 our $VERSION   = '0.03';
 our $AUTHORITY = 'cpan:STEVAN';
 
-use Plack::Util::Accessor qw( manager session options );
+use Plack::Util::Accessor qw( session options );
 
 sub new {
-    my ($class, $env, $manager ) = @_;
+    my ($class, $env) = @_;
     bless {
-        manager => $manager,
         session => $env->{'psgix.session'},
         options => $env->{'psgix.session.options'},
     }, $class;
@@ -60,12 +59,6 @@ sub expire {
     $self->options->{expire} = 1;
 }
 
-sub commit {
-    my $self = shift;
-    $self->options->{no_store} = 1;
-    $self->manager->commit($self->_data, $self->options);
-}
-
 1;
 
 __END__
@@ -92,7 +85,6 @@ Plack::Session - Middleware for session management
       $session->keys;
 
       $session->expire;
-      $session->commit;
   };
 
 =head1 DESCRIPTION
@@ -105,10 +97,9 @@ own session middleware component.
 
 =over 4
 
-=item B<new ( $env, $mw )>
+=item B<new ( $env )>
 
-The constructor takes a PSGI request env hash reference and
-Plack::Middleware::Session facade object.
+The constructor takes a PSGI request env hash reference.
 
 =item B<id>
 
@@ -140,11 +131,6 @@ you call C<finalize> on it.
 
 =over 4
 
-=item B<commit>
-
-This method synchronizes the session data to the data store, without
-waiting for the response final phase.
-
 =item B<expire>
 
 This method can be called to expire the current session id.