s/plack.session/psgix.session/
Stevan Little [Thu, 7 Jan 2010 20:49:28 +0000 (15:49 -0500)]
lib/Plack/Middleware/Session.pm
t/010_middleware.t
t/011_middleware_w_custom_session.t

index 6a8e891..fe38b96 100644 (file)
@@ -45,7 +45,7 @@ sub call {
     my $self = shift;
     my $env  = shift;
 
-    $env->{'plack.session'} = $self->session_class->new(
+    $env->{'psgix.session'} = $env->{'plack.session'} = $self->session_class->new(
         state   => $self->state,
         store   => $self->store,
         request => Plack::Request->new( $env )
@@ -54,7 +54,7 @@ sub call {
     my $res = $self->app->($env);
     $self->response_cb($res, sub {
         my $res = Plack::Response->new(@{$_[0]});
-        $env->{'plack.session'}->finalize( $res );
+        $env->{'psgix.session'}->finalize( $res );
         $res = $res->finalize;
         $_[0]->[0] = $res->[0];
         $_[0]->[1] = $res->[1];
@@ -80,7 +80,7 @@ Plack::Middleware::Session - Middleware for session management
       return [
           200,
           [ 'Content-Type' => 'text/plain' ],
-          [ 'Hello, your Session ID is ' . $env->{'plack.session'}->id ]
+          [ 'Hello, your Session ID is ' . $env->{'psgix.session'}->id ]
       ];
   };
 
@@ -104,10 +104,15 @@ memory. This distribution also comes with other state and store
 solutions. See perldoc for these backends how to use them.
 
 It should be noted that we store the current session in the
-C<plack.session> key inside the C<$env> where you can access it
+C<psgix.session> key inside the C<$env> where you can access it
 as needed. Additionally, as of version 0.09, you can call the
 C<session> method of a L<Plack::Request> instance to fetch
-whatever is stored in C<plack.session>.
+whatever is stored in C<psgix.session>.
+
+B<NOTE:> As of version 0.02 the session is stored in C<psgix.session>
+instead of C<plack.session>. We still keep a copy of it in
+C<plack.session>, but this is deprecated and will be removed
+in future versions.
 
 =head2 State
 
index 190497d..4a71f8f 100644 (file)
@@ -6,11 +6,11 @@ use HTTP::Cookies;
 
 my $app = sub {
     my $env = shift;
-    my $counter = $env->{'plack.session'}->get('counter') || 0;
+    my $counter = $env->{'psgix.session'}->get('counter') || 0;
 
     my $body = "Counter=$counter";
     $counter++;
-    $env->{'plack.session'}->set(counter => $counter);
+    $env->{'psgix.session'}->set(counter => $counter);
 
     return [ 200, [], [ $body ] ];
 };
index 4482078..e23c553 100644 (file)
@@ -14,13 +14,13 @@ use HTTP::Cookies;
 my $app = sub {
     my $env = shift;
 
-    isa_ok($env->{'plack.session'}, 'My::Custom::Session');
+    isa_ok($env->{'psgix.session'}, 'My::Custom::Session');
 
-    my $counter = $env->{'plack.session'}->get('counter') || 0;
+    my $counter = $env->{'psgix.session'}->get('counter') || 0;
 
     my $body = "Counter=$counter";
     $counter++;
-    $env->{'plack.session'}->set(counter => $counter);
+    $env->{'psgix.session'}->set(counter => $counter);
 
     return [ 200, [], [ $body ] ];
 };