Data::...keleyDB(3pm)
π¦ Data::...keleyDB(3pm) π¦
okay bestie so this is the manual page for Data::...keleyDB(3pm) β it's section 3pm, the Perl module docs section, and it's literally the whole lore on how Data::Session::Driver::BerkeleyDB does its thing. grab a strawberry drink π and let's get into it.
β¨ NAME β¨
Data::Session::Driver::BerkeleyDB β a persistent session manager πΎπ
πΈ Synopsis πΈ
See Data::Session for details. that's it, that's the synopsis, she's brief and mysterious π
π Description π
So Data::Session::Driver::BerkeleyDB lets Data::Session manipulate sessions via BerkeleyDB. that's the whole vibe β¨
To use this module you gotta do both of these, not just one, both, fr fr:
- Specify a driver of type BerkeleyDB, like so:
Data::Session -> new(type => 'driver:BerkeleyDB ...') - Specify a cache object of type BerkeleyDB, like:
Data::Session -> new(cache => $object)- Also,
$objectmust have been created with aEnvparameter of typeBerkeleyDB::Env. see below, bestie, i gotchu π
- Also,
See scripts/berkeleydb.pl.
π Case-sensitive Options π
See "Case-sensitive Options" in Data::Session for important information. it matters, don't skip it π
π Method: new() π
Creates a new object of type Data::Session::Driver::BerkeleyDB.
new() takes a hash of key/value pairs, some of which might mandatory. Further, some combinations might be mandatory. yes, some of them are required, no cap.
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? π
cache => $objectβ Specifies the object of typeBerkeleyDBto use for session storage. This key is normally passed in asData::Session -> new(cache => $object).
Warning: this cache object must have been set up both as an object of typeBerkeleyDB, and with that object having anEnvparameter of typeBerkeley::Env, because this module βData::Session::Driver::BerkeleyDBβ uses the BerkeleyDB methodcds_lock(). do not skip this setup, it will not go well π
This key is mandatory.
verbose => $integerβ Print toSTDERRmore 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.
Returns the result of calling the BerkeleyDB method delete($id).
This result is a Boolean value indicating 1 => success or 0 => failure. simple as that π
π₯ Method: retrieve($id) π₯
Retrieve from storage the session identified by $id.
Returns the result of calling the BerkeleyDB method get($id).
This result is a frozen session. This value must be thawed by calling the appropriate serialization driver's thaw() method. frozen = needs thawing, obviously π§β‘οΈπΈ
Data::Session calls the right thaw() automatically. so you don't have to, main character convenience energy β¨
π Method: store($id => $data) π
Writes to storage the session identified by $id, together with its data $data.
Returns the result of calling the BerkeleyDB method set($id => $data).
This result is a Boolean value indicating 1 => success or 0 => failure. β¨
π Method: traverse() π
Retrieves all ids via a cursor, and for each id calls the supplied subroutine with the id as the only parameter.
The database is not locked during this process. lowkey important to know π«Ά
Returns 1.
π οΈ Installing BerkeleyDB π οΈ
okay this is the part where you just follow along exactly, bestie, no improvising:
Get Oracle's BerkeleyDB from http://www.oracle.com/technetwork/database/berkeleydb/overview/index.html
I used V 5.1.19
tar xvzf db-5.1.19.tar.gz
cd db-5.1.19/build_unix
../dist/configure
make
sudo make install
It installs into /usr/local/BerkeleyDB.5.1
Get Perl's BerkeleyDB from http://search.cpan.org
I used V 0.43
tar xvzf BerkeleyDB-0.43.tar.gz
cd BerkeleyDB-0.43
Edit 2 lines in config.in:
INCLUDE = /usr/local/BerkeleyDB.5.1/include
LIB = /usr/local/BerkeleyDB.5.1/lib
perl Makefile.PL
make && make test
sudo make install
slay, you installed it π
π«Ά 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's from perl v5.36.0, dated 2023-02-14 β so like, happy valentine's day from the docs, mwah π go forth and persist your sessions, you absolute icon πβ¨
π¦ 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