Dancer::Core::Session - class to represent any session object
version 2.0000_01
A session object encapsulates anything related to a specific session: its ID, its data, and its expiration.
It is completely agnostic of how it will be stored, this is the role of a factory that consumes Dancer::Core::Role::SessionFactory to know about that.
Generally, session objects should not be created directly. The correct way to get a new session object is to call the create() method on a session engine that implements the SessionFactory role. This is done automatically by the context object if a session engine is defined.
create()
The identifier of the session object. Required. By default, Dancer::Core::Role::SessionFactory sets this to a randomly-generated, guaranteed-unique string.
Contains the data of the session (Hash).
Number of seconds for the expiry of the session cookie. Don't add the current timestamp to it, will be done automatically.
Default is no expiry (session cookie will leave for the whole browser's session).
For a lifetime of one hour:
expires => 3600
Reader on the session data
my $value = $session->read('something');
Returns undef if the key does not exist in the session.
undef
Writer on the session data
$session->write('something', $value);
Returns $value.
$value
Deletes a key from session data
$session->delete('something');
Returns the value deleted from the session.
Dancer Core Developers
This software is copyright (c) 2012 by Alexis Sukrieh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Dancer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer
CPAN shell
perl -MCPAN -e shell install Dancer
For more information on module installation, please visit the detailed CPAN module installation guide.