AnyDBM_File(3p) Perl Programmers Reference Guide AnyDBM_File(3p)
AnyDBM_File - provide framework for multiple DBMs
NDBM_File, DB_File, GDBM_File, SDBM_File, ODBM_File - vari-
ous DBM implementations
use AnyDBM_File;
This module is a "pure virtual base class"--it has nothing
of its own. It's just there to inherit from one of the vari-
ous DBM packages. It prefers ndbm for compatibility reasons
with Perl 4, then Berkeley DB (See DB_File), GDBM, SDBM
(which is always there--it comes with Perl), and finally
ODBM. This way old programs that used to use NDBM via
dbmopen() can still do so, but new ones can reorder @ISA:
BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File) }
use AnyDBM_File;
Having multiple DBM implementations makes it trivial to copy
database formats:
use POSIX; use NDBM_File; use DB_File;
tie %newhash, 'DB_File', $new_filename, O_CREAT|O_RDWR;
tie %oldhash, 'NDBM_File', $old_filename, 1, 0;
%newhash = %oldhash;
DBM Comparisons
Here's a partial table of features the different packages
offer:
odbm ndbm sdbm gdbm bsd-db
---- ---- ---- ---- ------
Linkage comes w/ perl yes yes yes yes yes
Src comes w/ perl no no yes no no
Comes w/ many unix os yes yes[0] no no no
Builds ok on !unix ? ? yes yes ?
Code Size ? ? small big big
Database Size ? ? small big? ok[1]
Speed ? ? slow ok fast
FTPable no no yes yes yes
Easy to build N/A N/A yes yes ok[2]
Size limits 1k 4k 1k[3] none none
Byte-order independent no no no no yes
Licensing restrictions ? ? no yes no
[0] on mixed universe machines, may be in the bsd compat
library, which is often shunned.
perl v5.8.8 2005-02-05 1
AnyDBM_File(3p) Perl Programmers Reference Guide AnyDBM_File(3p)
[1] Can be trimmed if you compile for one access method.
[2] See DB_File. Requires symbolic links.
[3] By default, but can be redefined.
dbm(3), ndbm(3), DB_File(3), perldbmfilter
perl v5.8.8 2005-02-05 2
Generated on 2013-04-27 00:20:00 by $MirOS: src/scripts/roff2htm,v 1.77 2013/01/01 20:49:09 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2013 The MirOS Project, Germany.
This product includes material
provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.