NAME
Paranoid::BerkeleyDB -- BerkeleyDB Wrapper
VERSION
$Id: lib/Paranoid/BerkeleyDB.pm, 2.00 2016/05/13 19:47:47 acorliss Exp $
SYNOPSIS
tie %db, Paranoid::BerkeleyDB,
Home => './dbdir',
Filename => 'data.db';
# Normal hash activities...
untie %db;
DESCRIPTION
This module provides an OO/tie-based wrapper for BerkeleyDB CDS implementations intended for use in tied hashes.
NOTE: This module breaks significantly with previous incarnations of this module. The primary differences are as follows:
Pros
-------------------------------------------------------------
* Places no limitations on the developer regarding BerekelyDB
environment and database options
* Automatically reuses existing environments for multiple
tied hashses
* Uses Btree databases in lieu of hashes, which tended to
have issues when the database size grew too large
* Has a fully implemented tied hash interface incorporating
CDS locks
* Has pervasive debugging built in using L<Paranoid::Debug>
Cons
-------------------------------------------------------------
* Is no longer considered fork-safe, attempted accesses will
case the child process to B<croak>.
* Uses Btree databases in lieu of hashes, which does add
some additional memory overhead
SUBROUTINES/METHODS
new
tie %db, Paranoid::BerkeleyDB,
Home => './dbdir',
Filename => 'data.db';
This method is called implicitly when an object is tied. It supports a few differnet invocation styles. The simplest involves simply providing the Home and Filename options. This will set up a CDS environment using the defaults documented in Paranoid::BerkeleyDB::Env and Paranoid::BerkeleyDB::Db.
Alternately, you can provide it with Filename and a Paranoid::BerkeleyDB::Env object (or subclassed object) that you instantiated yourself:
tie %db, Paranoid::BerkeleyDB,
Env => $env,
Filename => 'data.db';
Finally, you can provide it with two hash options to fully control the environment and database instantiation of Paranoid::BerkeleyDB::Env and Paranoid::BerkeleyDB::Db:
tie %db, Paranoid::BerkeleyDB,
Env => { %envOpts },
Db => { %dbOpts };
dbh
$dbh = $db->dbh;
This method provides access to the BerkeleyDB::Btree object reference.
DEPENDENCIES
- o
- o
- o
- o
- o
- o
- o
- o
- o
- o
BUGS AND LIMITATIONS
-Filename is interpreted differently depending on whether you're using an environment or not. If you're using this module as a standalone DB object any relative paths are interpreted according to your current working directory. If you are using an environment, however, it is interpreted relative to that environment's -Home.
SEE ALSO
L<BerkeleyDB(3)>, L<Paranoid::BerkeleyDB::Env>,
L<Paranoid::BerkeleyDB::Db>
HISTORY
02/12/2016 Complete rewrite
AUTHOR
Arthur Corliss (corliss@digitalmages.com)
LICENSE AND COPYRIGHT
This software is licensed under the same terms as Perl, itself. Please see http://dev.perl.org/licenses/ for more information.
(c) 2005 - 2016, Arthur Corliss (corliss@digitalmages.com)