MasonX::Request::WithMultiSession2 - Multiple sub-sessions within one "parent" session


MasonX-Request-WithApacheSession2 documentation  | view source Contained in the MasonX-Request-WithApacheSession2 distribution.

Index


NAME

Top

MasonX::Request::WithMultiSession2 - Multiple sub-sessions within one "parent" session

SYNOPSIS

Top

  PerlSetVar  MasonRequestClass  MasonX::Request::WithMultiSession2

DESCRIPTION

Top

MasonX::Request::WithMultiSession2 is highly experimental ( alpha ) and should only be used in a test environment.

MasonX::Request::WithMultiSession2 is a clone of MasonX::Request::WithMultiSession changed to work under a pure mod_perl2 environment. The external interface is unchanged, see MasonX::Request::WithMultiSession.

The actual changes I made can be found in the distribution in diff/WithMultiSession.diff ( made with 'diff -Naru' ... ).

A HOWTO for HTML::Mason::ApacheHandler2 and friends may be found at Mason-with-mod_perl2.

The following documentation is from MasonX::Request::WithMultiSession.

This module subclasses MasonX::Request::WithApacheSession2 in order to allow multiple "sub-sessions" to exist within one parent session.

This can be quite useful for a web app where you want to allow the user to open multiple windows, each with a different session, but session ids are stored in a cookie.

Like MasonX::Request::WithApacheSession2, sub-sessions are shared between a request and any subrequests it creates.

METHODS

Top

This class has an interface quite similar to that of MasonX::Request::WithApacheSession2.

* session

The primary interface to this class is through the session() method. When this method is called without any parameters, the module looks for an existing sub-session specified by the sub-session id argument parameter (which can be in a query string or POST). This value can be overridden by explicitly passing a "sub_session_id" parameter.

If this parameter is found, an existing sub-session is returned. If this parameter is not found, a new sub-session is created.

If the session() method is called as session( clone => 1 ) then a new sub-session will be created, and its contents will be the same as that of the current sub-session. This is a shallow copy of the old session hash, so objects and references are shared between them.

If session( new => 1 ) is called, then a new, empty, sub-session is created.

You can specify the main session id to use via the "session_id" parameter.

* sub_session_id

This method returns the currently active sub-session's id. Use this method to put this id into URL parameters, forms, etc. as needed.

If given a "sub_session_id" parameter, it will set the current sub-session id.

* delete_sub_session

By default, this simply defaults the current sub-session. You can pass a "sub_session_id" parameter to delete a specific session.

Parameters

This module takes two parameters besides those inherited from MasonX::Request::WithApacheSession2:

* multi_session_args_param / MultiSessionArgsParam

This parameter can be used to specify which parameter contains the sub-session id. By default, the module will look for a parameter called "sub_session_id".

* multi_session_expire / MultiSessionExpire

This parameter specifies the number of seconds after a sub-session is accessed until it is purged. If not specified, then sub-sessions are never purged.

Sub-sessions expiration is checked when the request object goes out of scope.

USAGE

Top

You will need to manually set the sub-session id argument parameter for each request. The easiest way to do this is to make sure that all URLs contain the sub-session id. This can be done by using a <%filter> block in a top-level autohandler (although this won't catch redirects), or by making sure all URLs are generated by a single component/function.

SUPPORT

Top

Bug reports and requests for help should be sent <mason@beaucox.com>.

AUTHOR

Top

Beau E. Cox <mason@beaucox.com> http://beaucox.com.

The real authors (I just made mod_perl2 changes) is Dave Rolsky, <autarch@urth.org>

Version 0.01 as of January, 2004.

SEE ALSO

Top

My documents, including: HOWTO Run Mason with mod_perl2 (Mason-with-mod_perl2), HTML::Mason::ApacheHandler2 (ApacheHandler2), MasonX::Request::WithApacheSession2 (WithApacheSession2).

Original Mason documents, including: HTML::Mason::ApacheHandler (ApacheHandler), MasonX::Request::WithApacheSession (WithApacheSession), MasonX::Request::WithMultiSession (WithMultiSession).

Also see the Mason documentation at http://masonhq.com/docs/manual/.


MasonX-Request-WithApacheSession2 documentation  | view source Contained in the MasonX-Request-WithApacheSession2 distribution.