NAME

WWW::Session::Storage::MySQL - MySQL storage for WWW::Session

VERSION

Version 0.02

SYNOPSIS

This module is used for storring serialized WWW::Session objects in MySQL

Usage :

use WWW::Session::Storage::MySQL;

my $storage = WWW::Session::Storage::MySQL->new({ 
                            dbh => $dbh,
                            table => 'sessions',
                            fields => {
                                sid => 'session_id',
                                expires => 'expires',
                                data => 'data'
                            }
            });
...

$storage->save($session_id,$expires,$serialized_data);

my $serialized_data = $storage->retrive($session_id);

SUBROUTINES/METHODS

new

Creates a new WWW::Session::Storage::MySQL object

This method accepts only one argument, a hashref that must contain the fallowing data:

  • dbh Database handle

  • table The name of the table where the sessions will be stored

  • fields A hash ref containing the falowing keys

    • sid The same of the database field which will store the session id

    • expires The same of the database field which will store the expiration time

    • data The name of the field where the session data will be stored

save

Stores the given information into the database

retrieve

Retrieves the informations for a session, verifies that it's not expired and returns the string containing the serialized data

delete

Completely removes the session data for the given session id

Private methods

_determine_expires_type

Tries to determine if the expires field is UnixTimestamp or DateTime

AUTHOR

Gligan Calin Horea, <gliganh at gmail.com>

BUGS

Please report any bugs or feature requests to bug-www-session at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Session. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc WWW::Session::Storage::MySQL

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 Gligan Calin Horea.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.