Data::...ver::Pg(3pm)
π Data::Session::Driver::Pg π
okay bestie, welcome to the Data::Session::Driver::Pg page β it's part of the User Contributed Perl Documentation crew, and it's basically the Postgres-era glow-up of your session storage. πβ¨
πΈ NAME πΈ
Data::Session::Driver::Pg β it's a persistent session manager. that's the whole vibe. π
β¨ Synopsis β¨
ngl the synopsis is short and mysterious:
See Data::Session for details.
iconic of it, honestly. go read that one, bestie. π«Ά
π¦ Description π¦
so here's the tea: Data::Session::Driver::Pg lets Data::Session manipulate sessions through DBD::Pg. that's it, that's the job, and it ate. π₯
to actually use this module you gotta do both of these things:
- Specify a driver of type
Pg, likeData::Session -> new(type => 'driver:Pg ...') - Specify a database handle like
Data::Session -> new(dbh => $dbh)or a data source likeData::Session -> new(data_source => $string)
both. not one. both. periodt. π
π Case-sensitive Options π
for the important details, go check out "Case-sensitive Options" in Data::Session. don't skip it, it matters. π
π Method: new() π
creates a shiny new object of type Data::Session::Driver::Pg. main character energy fr. β¨
new() takes a hash of key/value pairs β some of which might be mandatory, and some combinations might be mandatory too. so like, read carefully, bestie. π
the keys are listed here in alphabetical order.
they're all lower-case because they're also method names, which means you can call them to set or get the value whenever you want. slay. π
data_col_name => $stringβ specifies the name of the column in the sessions table that holds the session data. this key is normally passed in asData::Session -> new(data_col_name => $string). default is'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 is''. this key is optional, as long as you supply a value for'dbh'.data_source_attr => $hashrefβ 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 => $hashref). default is{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 you don't specify it, the module will use the values of these keys to get a database handle:data_sourcedata_source_attrusernamepassword
default is ''. this key is optional.
host => $stringβ not used. πid_col_name => $stringβ specifies the name of the column in the sessions table that holds the session id. this key is normally passed in asData::Session -> new(id_col_name => $string). default is'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 is''. this key is optional.pg_bytea => $booleanβ specifies (ifpg_bytea => 1) that thea_sessioncolumn in the sessions table is of typebytea. this key is normally passed in asData::Session -> new(pg_bytea => $boolean). if both'pg_bytea'and'pg_text'are set to 1,'pg_text'is forced to be 0. if both'pg_bytea'and'pg_text'are set to 0,'pg_bytea'is forced to be 1. π«pg_text => $booleanβ specifies (ifpg_text => 1) that thea_sessioncolumn in the sessions table is of typetext. this key is normally passed in asData::Session -> new(pg_text => $boolean).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 is'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 is''. this key is optional.verbose => $integerβ prints more or less information toSTDERR. this key is normally passed in asData::Session -> new(verbose => $integer). typical values are 0, 1 and 2. this key is optional.
π₯ Method: remove($id) π₯
deletes the session identified by $id from storage β or dies if it can't. no in-between, no negotiating. π€
returns 1. π«Ά
β Method: retrieve($id) β
retrieves the session identified by $id from storage β or dies if it can't. same energy as above.
returns the session.
heads up bestie: this is a frozen session. you must thaw this value by calling the appropriate serialization driver'sthaw()method.Data::Sessioncalls the rightthaw()automatically, so you're covered. π
π Method: store($id => $data) π
writes the session identified by $id, together with its data $data, to storage β or dies if it can't. you know the drill. π
$dbh -> selectall_arrayref is used, and the table is not locked. noted. π
returns 1. β¨
π§ Method: traverse() π§
retrieves all ids from the sessions table, and for each id it calls the supplied subroutine with the id as the only parameter. one by one, bestie, very demure. π
returns 1. π
π Support π
log a bug on RT: <https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Session>.
π 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, bestie π«Ά this one came to you courtesy of perl v5.36.0 and it's dated 2023-02-14 β valentine's day, which is honestly so on brand for a page this cute πβ¨π
π¦ 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