GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MasonX::Request::WithApacheSession(3) User Contributed Perl Documentation MasonX::Request::WithApacheSession(3)
 

MasonX::Request::WithApacheSession - Add a session to the Mason Request object

In your httpd.conf file:
  PerlSetVar  MasonRequestClass            MasonX::Request::WithApacheSession
  PerlSetVar  MasonSessionCookieDomain     .example.com
  PerlSetVar  MasonSessionClass            Apache::Session::File
  PerlSetVar  MasonSessionDirectory        /tmp/sessions/data
  PerlSetVar  MasonSessionLockDirectory    /tmp/sessions/locks
Or when creating an ApacheHandler object:
  my $ah =
      HTML::Mason::ApacheHandler->new
          ( request_class => 'MasonX::Request::WithApacheSession',
            session_cookie_domain  => '.example.com',
            session_class          => 'Apache::Session::File',
            session_directory      => '/tmp/sessions/data',
            session_lock_directory => '/tmp/sessions/locks',
          );
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.

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  MasonX::Request::WithApacheSession
If you are using a handler.pl file, simply add this parameter to the parameters given to the ApacheHandler constructor:
  request_class => 'MasonX::Request::WithApacheSession'

This class adds two methods to the Request object.
session
This method returns a hash tied to the "Apache::Session" class.
delete_session
This method deletes the existing session from persistent storage. If you are using the built-in cookie mechanism, it also deletes the cookie in the browser.

This module accepts quite a number of parameters, most of which are simply passed through to "Apache::Session::Wrapper". For this reason, you are advised to familiarize yourself with the "Apache::Session::Wrapper" documentation before attempting to configure this module.
If you are creating your own Interp/ApacheHandler/CGIHandler object in a script or module, you should pass this object the parameters intended for "Apache::Session::Wrapper", prefixed with "session_". So to set the "class" parameter for "Apache::Session::Wrapper", you pass in a "session_class" parameter.
If you are configuring Mason via your httpd.conf file, you should pass the "StudlyCaps" version of the name, prefixed by "MasonSession". So the "class" parameter would be "MasonSessionClass".
A few examples:
class becomes session_class / MasonSessionClass
always_write becomes session_always_write / MasonSessionAlwaysWrite
When running under ApacheHandler or CGIHandler, this module takes care of passing the "header_object" and "param_object" parameters to "Apache::Session::Wrapper". These will be the "Apache::Request" or "CGI.pm" objects, as applicable.
The "cookie_name" parameter defaults to "MasonX-Request-WithApacheSession-cookie" when you use this module, instead of "Apache-Session-Wrapper-cookie".
Finally, for backwards compatiblity, this module accepts a "session_args_param" parameter, which corresponds to the "param_name" parameter for "Apache::Session::Wrapper".

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.
Bug reports and requests for help should be sent to the mason-users list. See http://www.masonhq.com/resources/mailing_lists.html for more details.

Dave Rolsky, <autarch@urth.org>

Brad Lhotsky, <blhotsky@cpan.org>

HTML::Mason
2019-01-02 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.