Stevan Little > Plack-Middleware-Session-0.03 > Plack::Session

Download:
Plack-Middleware-Session-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.03   Source   Latest Release: Plack-Middleware-Session-0.21

NAME ^

Plack::Session - Middleware for session management

SYNOPSIS ^

  use Plack::Session;

  my $store = Plack::Session::Store->new;
  my $state = Plack::Session::State->new;

  my $s = Plack::Session->new(
      store   => $store,
      state   => $state,
      request => Plack::Request->new( $env )
  );

  # ...

DESCRIPTION ^

This is the core session object, you probably want to look at Plack::Middleware::Session, unless you are writing your own session middleware component.

METHODS ^

new ( %params )

The constructor expects keys in %params for state, store and request. The request param is expected to be a Plack::Request instance or an object with an equivalent interface.

id

This is the accessor for the session id.

state

This is expected to be a Plack::Session::State instance or an object with an equivalent interface.

store

This is expected to be a Plack::Session::Store instance or an object with an equivalent interface.

Session Data Storage

These methods delegate to appropriate methods on the store to manage your session data.

get ( $key )
set ( $key, $value )
remove ( $key )

Session Lifecycle Management

expire

This method can be called to expire the current session id. It will call the cleanup method on the store and the finalize method on the state, passing both of them the session id and the $response.

finalize ( $response )

This method should be called at the end of the response cycle. It will call the persist method on the store and the expire_session_id method on the state, passing both of them the session id. The $response is expected to be a Plack::Response instance or an object with an equivalent interface.

BUGS ^

All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.

AUTHOR ^

Stevan Little <stevan.little@iinteractive.com>

COPYRIGHT AND LICENSE ^

Copyright 2009, 2010 Infinity Interactive, Inc.

http://www.iinteractive.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: