5 our @ISA = qw(NDBM_File DB_File GDBM_File SDBM_File ODBM_File) unless @ISA;
9 if (eval "require $mod") {
10 @ISA = ($mod); # if we leave @ISA alone, warnings abound
15 die "No DBM package was successfully found or installed";
20 AnyDBM_File - provide framework for multiple DBMs
22 NDBM_File, DB_File, GDBM_File, SDBM_File, ODBM_File - various DBM implementations
30 This module is a "pure virtual base class"--it has nothing of its own.
31 It's just there to inherit from one of the various DBM packages. It
32 prefers ndbm for compatibility reasons with Perl 4, then Berkeley DB (See
33 L<DB_File>), GDBM, SDBM (which is always there--it comes with Perl), and
34 finally ODBM. This way old programs that used to use NDBM via dbmopen()
35 can still do so, but new ones can reorder @ISA:
37 BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File) }
40 Having multiple DBM implementations makes it trivial to copy database formats:
42 use POSIX; use NDBM_File; use DB_File;
43 tie %newhash, 'DB_File', $new_filename, O_CREAT|O_RDWR;
44 tie %oldhash, 'NDBM_File', $old_filename, 1, 0;
47 =head2 DBM Comparisons
49 Here's a partial table of features the different packages offer:
51 odbm ndbm sdbm gdbm bsd-db
52 ---- ---- ---- ---- ------
53 Linkage comes w/ perl yes yes yes yes yes
54 Src comes w/ perl no no yes no no
55 Comes w/ many unix os yes yes[0] no no no
56 Builds ok on !unix ? ? yes yes ?
57 Code Size ? ? small big big
58 Database Size ? ? small big? ok[1]
59 Speed ? ? slow ok fast
60 FTPable no no yes yes yes
61 Easy to build N/A N/A yes yes ok[2]
62 Size limits 1k 4k 1k[3] none none
63 Byte-order independent no no no no yes
64 Licensing restrictions ? ? no yes no
71 on mixed universe machines, may be in the bsd compat library,
72 which is often shunned.
76 Can be trimmed if you compile for one access method.
81 Requires symbolic links.
85 By default, but can be redefined.
91 dbm(3), ndbm(3), DB_File(3), L<perldbmfilter>