The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.

expires

How long the session should last in seconds.

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

__PACKAGE__->config( 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.

COPYRIGHT

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