Web::Starch - Implementation independent session management.
my $starch = Web::Starch->new(
expires => 60 * 15, # 15 minutes
store => {
class => '::Memory',
},
);
my $new_session = $starch->session();
my $existing_session = $starch->session( $id );
This module provides a generic interface to managing sessions and is often refered to as the "manager" in this documentation.
Please see Web::Starch::Manual for some good holistic starter documentation.
This class support method proxies as described in "METHOD PROXIES" in Web::Starch::Manual.
my $starch = Web::Starch->new_with_plugins(
['::CookieArgs'],
store => { class=>'::Memory' },
cookie_name => 'my_session',
);
my $session = $starch->session();
print $session->cookie_args->{name}; # my_session
Starch plugins are applied using the new_with_plugins
constructor method. The first argument is an array ref of plugin names. The plugin names can be fully qualified, or relative to the Web::Starch::Plugin
namespace. A leading ::
signifies that the plugin's package name is relative.
More information about plugins can be found at "PLUGINS" in Web::Starch::Manual.
The Web::Starch::Store storage backend to use for persisting the session data. A hashref must be passed and it is expected to contain at least a class
key and will be converted into a store object automatically.
The class
can be fully qualified, or relative to the Web::Starch::Store
namespace. A leading ::
signifies that the store's package name is relative.
More information about stores can be found at "STORES" in Web::Starch::Manual.
How long, in seconds, a session should live after the last time it was modified. Defaults to 60 * 60 * 2
(2 hours).
See "EXPIRATION" in Web::Starch::Manual for more information.
The session key to store the "expires" in Web::Starch::Session value in. Defaults to __SESSION_EXPIRES__
.
The session key to store the "modified" in Web::Starch::Session value in. Defaults to __SESSION_MODIFIED__
.
The session key to store the "created" in Web::Starch::Session value in. Defaults to __SESSION_CREATED__
.
The underlying Web::Starch::Factory object which manages all the plugins and session/store object construction.
my $new_session = $starch->session();
my $existing_session = $starch->session( $id );
Returns a new Web::Starch::Session (or whatever "session_class" in Web::Starch::Factory returns) object for the specified session ID.
If no ID is specified, or is undef, then an ID will be automatically generated.
Additional arguments can be passed after the ID argument. These extra arguments will be passed to the session object constructor.
Aran Clary Deltac <bluefeet@gmail.com>
Thanks to ZipRecruiter for encouraging their employees to contribute back to the open source ecosystem. Without their dedication to quality software development this distribution would not exist.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.