Data::...:mysql(3pm)
β¨ NAME β¨
okay so bestie, welcome to Data::Session::Driver::mysql β a persistent session manager π (yes that's literally the whole name line, we're keeping it, it's iconic).
πΈ SYNOPSIS πΈ
See Data::Session for details. that's it, that's the synopsis, go read the main one π
π¦ DESCRIPTION π¦
Data::Session::Driver::mysql is the lil glow-up that lets Data::Session manipulate sessions via DBD::mysql. no cap π«Ά
To use this module, you gotta do both of these, not just one, both, fr fr:
- Specify a driver of type
mysql, likeData::Session -> new(type => 'driver:mysql ...') - Specify a database handle like
Data::Session -> new(dbh => $dbh), or a data source likeData::Session -> new(data_source => $string)
π CASE-SENSITIVE OPTIONS π
See "Case-sensitive Options" in Data::Session for important information. (yes it's important, go look, I'm not playing π)
π METHOD: new() π
Creates a new object of type Data::Session::Driver::mysql. main character energy only β¨
new() takes a hash of key/value pairs, some of which might be mandatory. Further, some combinations might be mandatory. yeah I know, vague, but that's the tea.
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. cute, right? π§
data_col_name => $stringβ Specifies the name of the column in the sessions table which holds the session data. This key is normally passed in asData::Session -> new(data_col_name => $string). Default:'a_session'. This key is optional.data_source => $stringβ Specifies the data source (as used byDBI -> connect($data_source, $username, $password, $data_source_attr)) to obtain a database handle. This key is normally passed in asData::Session -> new(data_source => $string). Default:''. This key is optional, as long as a value is supplied for'dbh'.data_source_attr => $hashrefβ Specifies the attributes (as used byDBI -> connect($data_source, $username, $password, $attr)) to obtain a database handle. This key is normally passed in asData::Session -> new(data_source_attr => $hashref). Default:{AutoCommit => 1, PrintError => 0, RaiseError => 1}. This key is optional.dbh => $dbhβ Specifies the database handle to use to access the sessions table. This key is normally passed in asData::Session -> new(dbh => $dbh). If not specified, this module will use the values of these keys to obtain a database handle:data_sourcedata_source_attrusernamepasswordDefault:''. This key is optional.
host => $stringβ Specifies the host name to attach to the data_source. SoData::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', ...).id_col_name => $stringβ Specifies the name of the column in the sessions table which holds the session id. This key is normally passed in asData::Session -> new(id_col_name => $string). Default:'id'. This key is optional.password => $stringβ Specifies the password (as used byDBI -> connect($data_source, $username, $password, $data_source_attr)) to obtain a database handle. This key is normally passed in asData::Session -> new(password => $string). Default:''. This key is optional.port => $stringβ Specifies the port number to attach to the data_source. SoData::Session -> new(data_source => 'dbi:mysql:database=test', port => '5000')generates the call$dbh = DBI -> connect('dbi:mysql:database=test;port=5000', ...).socket => $stringβ Specifies the socket to attach to the data_source. SoData::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 calledsocketand notmysql_socketis in case other drivers permit a socket option. thoughtful king behavior πtable_name => $stringβ Specifies the name of the sessions table. This key is normally passed in asData::Session -> new(table_name => $string). Default:'sessions'. This key is optional.username => $stringβ Specifies the username (as used byDBI -> connect($data_source, $username, $password, $data_source_attr)) to obtain a database handle. This key is normally passed in asData::Session -> new(username => $string). Default:''. This key is optional.verbose => $integerβ Print toSTDERRmore or less information. This key is normally passed in asData::Session -> new(verbose => $integer). Typical values are0,1and2. This key is optional.
π METHOD: remove($id) π
Deletes from storage the session identified by $id, or dies if it can't. like, it will literally just perish π
Returns 1.
π METHOD: retrieve($id) π
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. so you don't gotta, bestie, it's handled π«Ά
β METHOD: store($id => $data) β
Writes to storage the session identified by $id, together with its data $data, or dies if it can't.
Returns 1.
π METHOD: traverse() π
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. just so you know, no surprises β¨
Returns 1.
π SUPPORT π
Log a bug on RT: <https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Session>. (yes bestie, tell them everything, they wanna know π)
πΈ AUTHOR πΈ
Data::Session was written by Ron Savage <ron@savage.net.au> in 2010.
Home page: <http://savage.net.au/index.html>.
π COPYRIGHT π
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
and that's the whole page, periodt π this lil doc came from perl v5.36.0 and it's dated 2023-02-14 β like, Valentine's Day, the most romantic a manpage has ever been π mwah, go forth and store your sessions, ily π¦
π¦ where this page comes from
- debian trixie: libdata-session-perl 1.18-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdata-session-perl 1.18-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdata-session-perl 1.18-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdata-session-perl 1.18-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms