1Dancer2::Core::Session(U3s)er Contributed Perl DocumentatDiaonncer2::Core::Session(3)
2
3
4

NAME

6       Dancer2::Core::Session - class to represent any session object
7

VERSION

9       version 0.300004
10

DESCRIPTION

12       A session object encapsulates anything related to a specific session:
13       its ID, its data, and its expiration.
14
15       It is completely agnostic of how it will be stored, this is the role of
16       a factory that consumes Dancer2::Core::Role::SessionFactory to know
17       about that.
18
19       Generally, session objects should not be created directly.  The correct
20       way to get a new session object is to call the "create()" method on a
21       session engine that implements the SessionFactory role.  This is done
22       automatically by the app object if a session engine is defined.
23

ATTRIBUTES

25   id
26       The identifier of the session object. Required. By default,
27       Dancer2::Core::Role::SessionFactory sets this to a randomly-generated,
28       guaranteed-unique string.
29
30       This attribute can be modified if your Session implementation requires
31       this.
32
33   data
34       Contains the data of the session (Hash).
35
36   expires
37       Number of seconds for the expiry of the session cookie. Don't add the
38       current timestamp to it, will be done automatically.
39
40       Default is no expiry (session cookie will leave for the whole browser's
41       session).
42
43       For a lifetime of one hour:
44
45         expires => 3600
46
47   is_dirty
48       Boolean value for whether data in the session has been modified.
49

METHODS

51   read
52       Reader on the session data
53
54           my $value = $session->read('something');
55
56       Returns "undef" if the key does not exist in the session.
57
58   write
59       Writer on the session data
60
61         $session->write('something', $value);
62
63       Sets "is_dirty" to true. Returns $value.
64
65   delete
66       Deletes a key from session data
67
68         $session->delete('something');
69
70       Sets "is_dirty" to true. Returns the value deleted from the session.
71

AUTHOR

73       Dancer Core Developers
74
76       This software is copyright (c) 2020 by Alexis Sukrieh.
77
78       This is free software; you can redistribute it and/or modify it under
79       the same terms as the Perl 5 programming language system itself.
80
81
82
83perl v5.32.0                      2020-07-28         Dancer2::Core::Session(3)
Impressum