Data::...:SQLite(3pm)
β¨ NAME β¨
Data::Session::Driver::SQLite β a persistent session manager πΎβ¨ (it's a Perl module, and it's from the User Contributed Perl Documentation crew, iykyk π«Ά)
πΈ SYNOPSIS πΈ
Bestie, this one's a vibe-check-free zone β the synopsis lives somewhere else:
See Data::Session for details.
π¦ DESCRIPTION π¦
Data::Session::Driver::SQLite is literally the plug that lets Data::Session do its session-managing thing through DBD::SQLite. No cap, that's the whole job. π
To actually use this module you gotta do both of these, not just one:
- Specify a driver of type SQLite, like this:
Data::Session -> new(type => 'driver:SQLite ...') - Specify a database handle like
Data::Session -> new(dbh => $dbh), or a data source likeData::Session -> new(data_source => $string)
Also go peek at scripts/sqlite.pl β it's giving example energy π
π Case-sensitive Options π
Important info lives in "Case-sensitive Options" in Data::Session. Go read it, fr fr. Not optional. π
π Method: new() π
Creates a new object of type Data::Session::Driver::SQLite. Slay.
new() takes a hash of key/value pairs, and honestly some of them might be mandatory. Also, some combinations might be mandatory. Iconic behavior tbh.
The keys are listed here in alphabetical order, because we're organized like that. β
They're all lower-case because they're also method names β meaning you can call them to set or get the value at literally any time. Main character keys only. π
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 => $stringβ Specifies the attributes (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_attr => $string). 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_attrusernamepassword
Default: ''. This key is optional.
host => $stringβ Not used. π (it's just sitting there, existing, doing nothing, and honestly? relatable)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β Not used. πsocket => $stringβ Not used. π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 to STDERR more or less information. Typical values are0,1and2. This key is normally passed in asData::Session -> new(verbose => $integer). This key is optional.
π Method: remove($id) π
Deletes from storage the session identified by $id β or dies if it can't. No in-between, she's dramatic like that. π
Returns 1.
π§ Method: retrieve($id) π§
Retrieves from storage the session identified by $id β or dies if it can't. Same energy, different verb. π
Returns the session.
Heads up bestie: this is a frozen session. This value must be thawed by calling the appropriate serialization driver's thaw() method. π§β‘οΈπΈ
Good news tho: Data::Session calls the right thaw() automatically. She handles it. Periodt. π
π Method: store($id => $data) π
Writes to storage the session identified by $id, together with its data $data β or dies if it can't. Yes, more dying. It's a whole thing. π
Returns 1.
β Method: traverse() β
Retrieves all the ids from the sessions table, and for each id calls the supplied subroutine with the id as the only parameter. One at a time, no extras, respect the boundaries. β¨
It uses $dbh -> selectall_arrayref, and the table is not locked. Keep that in mind, okay? π«Ά
Returns 1.
π«Ά Support π«Ά
Log a bug on RT, bestie: <https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Session>. They wanna hear from you fr fr. π
πΈ Author πΈ
Data::Session was written by Ron Savage <ron@savage.net.au> in 2010. Legend behavior, honestly. π
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
Okay that's the whole page, and that's the tea. π This was Data::...:SQLite(3pm), shipped as part of perl v5.36.0, dated 2023-02-14 β yes, Valentine's Day, because this module loves you. π Bye bestie, go manage some sessions! π¦π β¨
π¦ 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