X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FPlack%2FMiddleware%2FSession.pm;h=dab15cb5491a425dafe84f091315601acb4ed7a4;hb=536da026900d9922f08c66bace617c5170b5d943;hp=03f8798b1e167f025d2927bf5c617f51976a44b8;hpb=30cc0a719190fa26fb7b844d21db3237b8441db6;p=catagits%2FWeb-Session.git diff --git a/lib/Plack/Middleware/Session.pm b/lib/Plack/Middleware/Session.pm index 03f8798..dab15cb 100644 --- a/lib/Plack/Middleware/Session.pm +++ b/lib/Plack/Middleware/Session.pm @@ -74,7 +74,12 @@ Plack::Middleware::Session - Middleware for session management use Plack::Builder; my $app = sub { - return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ]; + my $env = shift; + return [ + 200, + [ 'Content-Type' => 'text/plain' ], + [ 'Hello, your Session ID is ' . $env->{'plack.session'}->id ] + ]; }; builder { @@ -96,6 +101,12 @@ default it will use cookies to keep session state and store data in 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 key inside the C<$env> where you can access it +as needed. Additionally, as of version 0.09, you can call the +C method of a L instance to fetch +whatever is stored in C. + =head2 State =over 4