The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Catalyst::Plugin::Session::State::Stash - Maintain session IDs using the stash

SYNOPSIS

 use Catalyst qw/Session Session::State::Stash Session::Store::Foo/;

DESCRIPTION

An alternative state storage plugin that allows you some more flexibility in dealing with session storage. This plugin loads and saves the session ID from and to the stash.

METHODS

delete_session_id

Deletes the session. Unfortunately I've been unable to squash a bug that will stop you from opening a new session in the same execution, however. Patches welcome!

get_session_id

Gets the current session id.

set_session_id

Sets the session id to the shift.

get_session_expires

Gets when the current session expires.

set_session_expires

Sets how many seconds from now the session should expire.

EXTENDED METHODS

prepare_action

Loads the id off the stash.

setup_session

Defaults the stash_key parameter to _session.

CONFIGURATION

stash_key

The name of the hash key to use. Defaults to _session.

stash_delim

If present, splits stash_key at this character to nest. E.g. delim of '/' and key of '123/456' will store it as $c->stash->{123}->{456}

expires

How long the session should last in seconds.

For example, you could stick this in MyApp.pm:

  __PACKAGE__->config( 'Plugin::Session' => {
     stash_key  => 'session_id',
  });

BUGS

You can't delete a session then create a new one. If this is important to you, patches welcome. It is not important to me and fixing this for completeness is pretty low on my list of priorities.

CAVEATS

Manual work may be involved to make better use of this.

If you are writing a stateful web service with Catalyst::Plugin::Server::XMLRPC, you will probably only have to deal with loading, as when saving, the ID will already be on the stash.

SEE ALSO

Catalyst, Catalyst::Plugin::Session, Catalyst::Plugin::Session::State, Catalyst::Plugin::Session::State::Cookie (what you probably want).

AUTHORS

James Laver <perl -e 'printf qw/%s@%s.com cpan jameslaver/'>

CONTRIBUTORS

This module is derived from Catalyst::Plugin::Session::State::Cookie code.

Thanks to anyone who wrote code for that.

Thanks to Kent Fredric for a patch for nested keys

COPYRIGHT

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