Data::Session::Driver::mysql(3pm) | User Contributed Perl Documentation | Data::Session::Driver::mysql(3pm) |
Data::Session::Driver::mysql - A persistent session manager
See Data::Session for details.
Data::Session::Driver::mysql allows Data::Session to manipulate sessions via DBD::mysql.
To use this module do both of these :
See "Case-sensitive Options" in Data::Session for important information.
Creates a new object of type Data::Session::Driver::mysql.
"new()" takes a hash of key/value pairs, some of which might mandatory. Further, some combinations might be mandatory.
The keys are listed here in alphabetical order.
They are lower-case because they are (also) method names, meaning they can be called to set or get the value at any time.
This key is normally passed in as Data::Session -> new(data_col_name => $string).
Default: 'a_session'.
This key is optional.
This key is normally passed in as Data::Session -> new(data_source => $string).
Default: ''.
This key is optional, as long as a value is supplied for 'dbh'.
This key is normally passed in as Data::Session -> new(data_source_attr => $hashref).
Default: {AutoCommit => 1, PrintError => 0, RaiseError => 1}.
This key is optional.
This key is normally passed in as Data::Session -> new(dbh => $dbh).
If not specified, this module will use the values of these keys to obtain a database handle:
Default: ''.
This key is optional.
So Data::Session -> new(data_source => 'dbi:mysql:database=test', host => '192.168.100.1') generates the call $dbh = DBI -> connect('dbi:mysql:database=test;host=192.168.100.1', ...).
This key is normally passed in as Data::Session -> new(id_col_name => $string).
Default: 'id'.
This key is optional.
This key is normally passed in as Data::Session -> new(password => $string).
Default: ''.
This key is optional.
So Data::Session -> new(data_source => 'dbi:mysql:database=test', port => '5000') generates the call $dbh = DBI -> connect('dbi:mysql:database=test;port=5000', ...).
So Data::Session -> new(data_source => 'dbi:mysql:database=test', socket => '/dev/mysql.sock') generates the call $dbh = DBI -> connect('dbi:mysql:database=test;mysql_socket=/dev/mysql.sock', ...).
The reason this key is called socket and not mysql_socket is in case other drivers permit a socket option.
This key is normally passed in as Data::Session -> new(table_name => $string).
Default: 'sessions'.
This key is optional.
This key is normally passed in as Data::Session -> new(username => $string).
Default: ''.
This key is optional.
This key is normally passed in as Data::Session -> new(verbose => $integer).
Typical values are 0, 1 and 2.
This key is optional.
Deletes from storage the session identified by $id, or dies if it can't.
Returns 1.
Retrieve from storage the session identified by $id, or dies if it can't.
Returns the session.
This is a frozen session. This value must be thawed by calling the appropriate serialization driver's thaw() method.
Data::Session calls the right thaw() automatically.
Writes to storage the session identified by $id, together with its data $data, or dies if it can't.
Returns 1.
Retrieves all ids from the sessions table, and for each id calls the supplied subroutine with the id as the only parameter.
$dbh -> selectall_arrayref is used, and the table is not locked.
Returns 1.
Log a bug on RT: <https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Session>.
Data::Session was written by Ron Savage <ron@savage.net.au> in 2010.
Home page: <http://savage.net.au/index.html>.
Australian copyright (c) 2010, Ron Savage.
All Programs of mine are 'OSI Certified Open Source Software'; you can redistribute them and/or modify them under the terms of The Artistic License, a copy of which is available at: http://www.opensource.org/licenses/index.html
2023-02-14 | perl v5.36.0 |