Maypole::Plugin::Session - simple sessions for Maypole
use Maypole::Application qw( Session ); # Elsewhere in your app: my $session = $r->session;
This version is a re-write using Apache::Session::Wrapper. As such, the configuration parameters have changed - use Apache::Session::Wrapper settings rather than Apache::Session settings. See Configuration.
Provides session and delete_session methods for your Maypole request class. The session is implemented using Apache::Session::Wrapper, and as such, a range of session store mechanisms are available.
session
delete_session
The Configuration section of the Apache::Session::Wrapper docs lists all the available parameters. These should be placed in the Maypole::Config::session slot as a hashref.
Maypole::Config::session
If there are no settings in Maypole::Config->session, then default settings for Apache::Session::File are placed there. Also, cookies are turned on by default:
Maypole::Config->session
$config->{session} = { class => 'File', directory => "/tmp/sessions", lock_directory => "/tmp/sessionlock", use_cookie => 1, cookie_name => 'maypole-plugin-session-cookie', };
You need to create these directories with appropriate permissions if you want to use these defaults.
You can place custom settings there either before (preferably) or after (probably OK) calling Maypole->setup, e.g.
Maypole->setup
$r->config->session( { class => "Flex", store => 'DB_File', lock => 'Null', generate => 'MD5', serialize => 'Storable' } );
Returns the session hashref.
Deletes the session and cookie.
These are only necessary if you are writing custom authenticate method(s). Otherwise, they are called for you.
authenticate
This is called early in the Maypole request workflow, and is used as the hook to call get_session. If you are writing your own authenticate method(s), either in model classes or in the request classes, make sure your authenticate method calls get_session.
get_session
Retrieves the cookie from the browser and matches it up with a session in the store.
You should call this method inside any custom authenticate methods.
Apache::Session::Wrapper.
David Baird, <cpan@riverside-cms.co.uk>
<cpan@riverside-cms.co.uk>
Please report any bugs or feature requests to bug-maypole-plugin-session@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Maypole-Plugin-Session. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-maypole-plugin-session@rt.cpan.org
Copyright 2005 David Baird, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Maypole::Plugin::Session, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Maypole::Plugin::Session
CPAN shell
perl -MCPAN -e shell install Maypole::Plugin::Session
For more information on module installation, please visit the detailed CPAN module installation guide.