Catalyst::Plugin::Session::State::Stash - Maintain session IDs using the stash
version 0.14
use Catalyst qw/Session Session::State::Stash Session::Store::Foo/;
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.
- 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.
- prepare_action
-
Loads the id off the stash.
- setup_session
-
Defaults the
stash_key
parameter to_session
.
- 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. adelim
of '/' andstash_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',
});
You can't delete a session then create a new one. If this is important to you, patches welcome!
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.
Catalyst, Catalyst::Plugin::Session, Catalyst::Plugin::Session::State, Catalyst::Plugin::Session::State::Cookie (what you probably want).
James Laver <perl -e 'printf qw/%s@%s.com cpan jameslaver/'>
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
Florian Ragwitz <[email protected]>
Karen Etheridge <[email protected]>
Tomas Doran <[email protected]>
James Laver <[email protected]>
James Laver <[email protected]>
This software is copyright (c) 2009 by James Laver.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.