HTML::Mason::Request::WithApacheSession - Add a session to the Mason Request object In your httpd.conf file: PerlSetVar MasonRequestClass HTML::Mason::Request::WithApacheSession PerlSetVar MasonSessionCookieDomain .example.com PerlSetVar MasonSessionClass Apache::Session::MySQL PerlSetVar MasonSessionDataSource dbi:mysql:somedb In a component: $m->session->{foo} = 1; if ( $m->session->{bar}{baz} > 1 ) { ... } This module integrates "Apache::Session" into Mason by adding methods to the Mason Request object available in all Mason components. Any subrequests created by a request share the same session hash. To use this module you need to tell Mason to use this class for requests. This can be done in one of two ways. If you are configuring Mason via your httpd.conf file, simply add this: PerlSetVar MasonRequestClass HTML::Mason::Request::WithApacheSession If you are using a handler.pl file, simply add this parameter to the parameters given to the ApacheHandler constructor: request_class => 'HTML::Mason::Request::WithApacheSession' This module accepts quite a number of parameters, most of which are simply passed through to "Apache::Session". For this reason, you are advised to familiarize yourself with the "Apache::Session" documentation before attempting to configure tihs module.

Generic Parameters
The name of the "Apache::Session" subclass you would like to use. This module will load this class for you if necessary. This parameter is required. If this is true, then this module will ensure that "Apache::Session" writes the session. If it is false, the default "Apache::Session" behavior is used instead. This defaults to true. If this is true, an attempt to create a session with a session id that does not exist in the session storage will be ignored, and a new session will be created instead. If it is false, a "HTML::Mason::Exception::NonExistentSessionID" exception will be thrown instead. This defaults to true.

Cookie-Related Parameters
If true, then this module will use "Apache::Cookie" to set and read cookies that contain the session id. The cookie will be set again every time the client accesses a Mason component. This is the name of the cookie that this module will set. This defaults to "HTML-Mason-Request-WithApacheSession-cookie". Corresponds to the "Apache::Cookie" "-name" constructor parameter. How long before the cookie expires. This defaults to 1 day, "+1d". Corresponds to the "-expires" parameter. This corresponds to the "-domain" parameter. If not given this will not be set as part of the cookie. Corresponds to the "-path" parameter. It defaults to "/". Corresponds to the "-secure" parameter. It defaults to false.

Apache::Session-related Parameters
These parameters are simply passed through to "Apache::Session". Corresponds to the "DataSource" parameter given to the DBI-related session modules. Corresponds to the "UserName" parameter given to the DBI-related session modules. Corresponds to the "Password" parameter given to the DBI-related session modules. Corresponds to the "Handle" parameter given to the DBI-related session modules. Corresponds to the "LockDataSource" parameter given to "Apache::Session::MySQL". Corresponds to the "LockUserName" parameter given to "Apache::Session::MySQL". Corresponds to the "LockPassword" parameter given to "Apache::Session::MySQL". Corresponds to the "LockHandle" parameter given to the DBI-related session modules. Corresponds to the "Commit" parameter given to the DBI-related session modules. Corresponds to the "Transaction" parameter. Corresponds to the "Directory" parameter given to "Apache::Session::File". Corresponds to the "LockDirectory" parameter given to "Apache::Session::File". Corresponds to the "FileName" parameter given to "Apache::Session::DB_File". Corresponds to the "Store" parameter given to "Apache::Session::Flex". Corresponds to the "Lock" parameter given to "Apache::Session::Flex". Corresponds to the "Generate" parameter given to "Apache::Session::Flex". Corresponds to the "Serialize" parameter given to "Apache::Session::Flex". Corresponds to the "textsize" parameter given to "Apache::Session::Sybase". Corresponds to the "LongReadLen" parameter given to "Apache::Session::MySQL". Corresponds to the "NSems" parameter given to "Apache::Session::Lock::Semaphore". Corresponds to the "SemaphoreKey" parameter given to "Apache::Session::Lock::Semaphore". Corresponds to the "ModUsertrackCookieName" parameter given to "Apache::Session::Generate::ModUsertrack". Corresponds to the "SavePath" parameter given to "Apache::Session::PHP". As can be seen by the number of parameters above, "Apache::Session" has way too many possibilities for me to test all of them. This means there are almost certainly bugs. Dave Rolsky, <autarch@urth.org> HTML::Mason