1MasonX::Request::WithMuUlsteirSeCsosnitorni(b3u)ted PerlMaDsoocnuXm:e:nRteaqtuieosnt::WithMultiSession(3)
2
3
4
6 MasonX::Request::WithMultiSession - Multiple sub-sessions within one
7 "parent" session
8
10 PerlSetVar MasonRequestClass MasonX::Request::WithMultiSession
11
13 This module subclasses "MasonX::Request::WithApacheSession" in order to
14 allow multiple "sub-sessions" to exist within one parent session.
15
16 This can be quite useful for a web app where you want to allow the user
17 to open multiple windows, each with a different session, but session
18 ids are stored in a cookie.
19
20 Like "MasonX::Request::WithApacheSession", sub-sessions are shared
21 between a request and any subrequests it creates.
22
24 This class has an interface quite similar to that of
25 "MasonX::Request::WithApacheSession".
26
27 • session
28
29 The primary interface to this class is through the "session()"
30 method. When this method is called without any parameters, the
31 module looks for an existing sub-session specified by the sub-
32 session id argument parameter (which can be in a query string or
33 POST). This value can be overridden by explicitly passing a
34 "sub_session_id" parameter.
35
36 If this parameter is found, an existing sub-session is returned.
37 If this parameter is not found, a new sub-session is created.
38
39 If the "session()" method is called as "session( clone => 1 )" then
40 a new sub-session will be created, and its contents will be the
41 same as that of the current sub-session. This is a shallow copy of
42 the old session hash, so objects and references are shared between
43 them.
44
45 If "session( new => 1 )" is called, then a new, empty, sub-session
46 is created.
47
48 You can specify the main session id to use via the "session_id"
49 parameter.
50
51 • sub_session_id
52
53 This method returns the currently active sub-session's id. Use
54 this method to put this id into URL parameters, forms, etc. as
55 needed.
56
57 If given a "sub_session_id" parameter, it will set the current sub-
58 session id.
59
60 • delete_sub_session
61
62 By default, this simply defaults the current sub-session. You can
63 pass a "sub_session_id" parameter to delete a specific session.
64
65 Parameters
66 This module takes two parameters besides those inherited from
67 "MasonX::Request::WithApacheSession":
68
69 • multi_session_args_param / MultiSessionArgsParam
70
71 This parameter can be used to specify which parameter contains the
72 sub-session id. By default, the module will look for a parameter
73 called "sub_session_id".
74
75 • multi_session_expire / MultiSessionExpire
76
77 This parameter specifies the number of seconds after a sub-session
78 is accessed until it is purged. If not specified, then sub-
79 sessions are never purged.
80
81 Sub-sessions expiration is checked when the request object goes out
82 of scope.
83
85 You will need to manually set the sub-session id argument parameter for
86 each request. The easiest way to do this is to make sure that all URLs
87 contain the sub-session id. This can be done by using a "<%filter>"
88 block in a top-level autohandler (although this won't catch redirects),
89 or by making sure all URLs are generated by a single
90 component/function.
91
93 Bug reports and requests for help should be sent to the mason-users
94 list. See http://www.masonhq.com/resources/mailing_lists.html for more
95 details.
96
98 Dave Rolsky, <autarch@urth.org>
99
100 Development funded by Marigold Technologies.
101
103 HTML::Mason
104
105
106
107perl v5.34.0 2022-01-2M1asonX::Request::WithMultiSession(3)