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, like Data::Session -> new(type => 'driver:mysql ...')
  • Specify a database handle like Data::Session -> new(dbh => $dbh), or a data source like Data::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 as Data::Session -> new(data_col_name => $string). Default: 'a_session'. This key is optional.
  • data_source => $string β€” Specifies the data source (as used by DBI -> connect($data_source, $username, $password, $data_source_attr) ) to obtain a database handle. 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'.
  • data_source_attr => $hashref β€” Specifies the attributes (as used by DBI -> connect($data_source, $username, $password, $attr) ) to obtain a database handle. 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.
  • dbh => $dbh β€” Specifies the database handle to use to access the sessions table. 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:
    • data_source
    • data_source_attr
    • username
    • password Default: ''. This key is optional.
  • host => $string β€” Specifies the host name to attach to the data_source. 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', ...).
  • 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 as Data::Session -> new(id_col_name => $string). Default: 'id'. This key is optional.
  • password => $string β€” Specifies the password (as used by DBI -> connect($data_source, $username, $password, $data_source_attr) ) to obtain a database handle. This key is normally passed in as Data::Session -> new(password => $string). Default: ''. This key is optional.
  • port => $string β€” Specifies the port number to attach to the data_source. So Data::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. 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. thoughtful king behavior πŸ’œ
  • table_name => $string β€” Specifies the name of the sessions table. This key is normally passed in as Data::Session -> new(table_name => $string). Default: 'sessions'. This key is optional.
  • username => $string β€” Specifies the username (as used by DBI -> connect($data_source, $username, $password, $data_source_attr) ) to obtain a database handle. This key is normally passed in as Data::Session -> new(username => $string). Default: ''. This key is optional.
  • verbose => $integer β€” Print to STDERR more or less information. This key is normally passed in as Data::Session -> new(verbose => $integer). Typical values are 0, 1 and 2. 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>.


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