NAME
MasonX::Request::ExtendedCompRoot::WithApacheSession - Extend functionality of Mason's comp_root and add a session to the Mason Request object
SYNOPSIS
In your httpd.conf file:
PerlSetVar MasonRequestClass MasonX::Request::ExtendedCompRoot::WithApacheSession
PerlSetVar MasonResolverClass MasonX::Resolver::ExtendedCompRoot
PerlSetVar MasonSessionCookieDomain .example.com
PerlSetVar MasonSessionClass Apache::Session::MySQL
PerlSetVar MasonSessionDataSource dbi:mysql:somedb
Or when creating an ApacheHandler object:
my $ah =
HTML::Mason::ApacheHandler->new
( request_class => 'MasonX::Request::ExtendedCompRoot::WithApacheSession',
resolver_class => 'MasonX::Resolver::ExtendedCompRoot',
session_cookie_domain => '.example.com',
session_class => 'Apache::Session::MySQL',
session_data_source => 'dbi:mysql:somedb',
);
In a component:
# use a session
$m->session->{foo} = 1;
if ( $m->session->{bar}{baz} > 1 ) { ... }
# dynamically add a root to the component root
$m->prefix_comp_root('key=>/path/to/root');
# call a component in a specific component root
<& key=>/path/to/comp &>
DESCRIPTION
This module simply integrates MasonX::Request::ExtendedCompRoot
and MasonX::Request::WithApacheSession
.
USAGE
SET UP
To use this module you need to tell Mason to use this class for requests and MasonX::Resolver::ExtendedCompRoot
for its resolver. This can be done in two ways. If you are configuring Mason via your httpd.conf file, simply add this:
PerlSetVar MasonRequestClass MasonX::Request::ExtendedCompRoot::WithApacheSession
PerlSetVar MasonResolverClass MasonX::Resolver::ExtendedCompRoot
If you are using a handler.pl file, simply add this parameter to the parameters given to the ApacheHandler constructor:
request_class => 'MasonX::Request::ExtendedCompRoot::WithApacheSession'
resolver_class => 'MasonX::Resolver::ExtendedCompRoot'
METHODS
This class adds two methods from MasonX::Request::WithApacheSession
to the Request object (session
and delete_session
), and three from MasonX::Request::ExtendedCompRoot, (comp_root
, prefix_comp_root
and reset_comp_root
).
See the respective modules for documentation of these methods.
PREREQUISITES
MasonX::Request::ExtendedCompRoot, MasonX::Request::WithApacheSession
BUGS
No known bugs.
VERSION
0.04
SEE ALSO
HTML::Mason, MasonX::Request::ExtendedCompRoot, MasonX::Request::WithApacheSession
AUTHOR
Alex Robinson, <cpan[@]alex.cloudband.com>
LICENSE
MasonX::Request::ExtendedCompRoot::WithApacheSession is free software and can be used under the same terms as Perl, i.e. either the GNU Public Licence or the Artistic License.