Catalyst::Plugin::Session::State::Stash - Maintain session IDs using the stash
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.
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!
Gets the current session id.
Sets the session id to the shift.
shift
Gets when the current session expires.
Sets how many seconds from now the session should expire.
Loads the id off the stash.
Defaults the stash_key parameter to _session.
stash_key
_session
The name of the hash key to use. Defaults to _session.
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}
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. It is not important to me and fixing this for completeness is pretty low on my list of priorities.
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
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Plugin::Session::State::Stash, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::Session::State::Stash
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::Session::State::Stash
For more information on module installation, please visit the detailed CPAN module installation guide.