The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Eve::Session - a persistent session class.

SYNOPSIS

    # Construct the session object
    my $session = Eve::Session->new(
        id => $md5_id,
        storage_path => '/storage/path',
        expiration_interval => 3600);

    # Get the session identifier
    my $id = $session->get_id();

    # Set ang get the parameter
    $session->set_parameter(name => 'foo', value => 'bar');
    my $foo = $session->get_parameter(name => 'foo');

    # Set the parameter expired after 600 seconds of idling
    $session->set_parameter(
        name => 'foo', value => 'bar', expiration_interval => 600);

    # Clear the parameter
    $session->clear_parameter(name => 'foo');

DESCRIPTION

Eve::Session is a persistent session class allowing to share an identified state between application calls. The class adapts the package CGI::Session.

Constructor arguments

id

a session ID string (it can differ from the actual ID, see the get_id() method documentation)

storage_path

a path on the server where session files are stored

expiration_interval

an interval of idling from the last access when the session is considered actual (0 cancels expiration).

Attributes

expiration_interval

(read only) an expiration interval in seconds that has been initially set for the session.

Throws

Eve::Error::Session

when the session creation is unsuccessful.

METHODS

init()

get_id()

Returns

An md5 string identified the session. The string can be different from one that is specified in the constructor in case of not existing or expired session.

set_parameter()

Sets a named parameter in the session.

Arguments

name
value
expiration_interval

an interval of idling from the last access when the parameter is considered actual (0 cancels expiration).

Returns

The value passed to the method.

get_parameter()

Arguments

name

Returns

A parameter value.

clear_parameter()

Clears the parameter from the session.

Arguments

name

Returns

An old parameter value.

SEE ALSO

CGI::Session

LICENSE AND COPYRIGHT

Copyright 2012 Igor Zinovyev.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

AUTHOR

Sergey Konoplev