Data::Session::Driver::BerkeleyDB - A persistent session manager


Back to Top


NAME

the Data::Session::Driver::BerkeleyDB manpage - A persistent session manager

Back to Top


Synopsis

See the Data::Session manpage for details.

Back to Top


Description

the Data::Session::Driver::BerkeleyDB manpage allows the Data::Session manpage to manipulate sessions via the BerkeleyDB manpage.

To use this module do both of these:

o Specify a driver of type BerkeleyDB, as Data::Session -> new(type => 'driver:BerkeleyDB ...')
o Specify a cache object of type the BerkeleyDB manpage as Data::Session -> new(cache => $object)

Also, $object must have been created with a Env parameter of type the BerkeleyDB::Env manpage. See below.

See scripts/berkeleydb.pl.

Back to Top


Case-sensitive Options

See Case-sensitive Options in the Data::Session manpage for important information.

Back to Top


Method: new()

Creates a new object of type the Data::Session::Driver::BerkeleyDB manpage.

new() takes a hash of key/value pairs, some of which might mandatory. Further, some combinations might be mandatory.

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.

o cache => $object

Specifies the object of type the BerkeleyDB manpage to use for session storage.

This key is normally passed in as Data::Session -> new(cache => $object).

Warning: This cache object must have been set up both as an object of type the BerkeleyDB manpage, and with that object having an Env parameter of type the Berkeley::Env manpage, because this module - the Data::Session::Driver::BerkeleyDB manpage - uses the the BerkeleyDB manpage method cds_lock().

This key is mandatory.

o verbose => $integer

Print to STDERR more or less information.

Typical values are 0, 1 and 2.

This key is normally passed in as Data::Session -> new(verbose => $integer).

This key is optional.

Back to Top


Method: remove($id)

Deletes from storage the session identified by $id.

Returns the result of calling the the BerkeleyDB manpage method delete($id).

This result is a Boolean value indicating 1 => success or 0 => failure.

Back to Top


Method: retrieve($id)

Retrieve from storage the session identified by $id.

Returns the result of calling the the BerkeleyDB manpage method get($id).

This result is a frozen session. This value must be thawed by calling the appropriate serialization driver's thaw() method.

the Data::Session manpage calls the right thaw() automatically.

Back to Top


Method: store($id => $data)

Writes to storage the session identified by $id, together with its data $data.

Returns the result of calling the the BerkeleyDB manpage method set($id => $data).

This result is a Boolean value indicating 1 => success or 0 => failure.

Back to Top


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.

Returns 1.

Back to Top


Installing BerkeleyDB

        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

Back to Top


Support

Log a bug on RT: https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Session.

Back to Top


Author

the Data::Session manpage was written by Ron Savage <ron@savage.net.au> in 2010.

Home page: http://savage.net.au/index.html.

Back to Top


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

Back to Top

 Data::Session::Driver::BerkeleyDB - A persistent session manager