4 @ISA = qw(NDBM_File DB_File GDBM_File SDBM_File ODBM_File) unless @ISA;
8 return 1 if eval "require $mod"
11 die "No DBM package was successfully found or installed";
16 AnyDBM_File - provide framework for multiple DBMs
18 NDBM_File, ODBM_File, SDBM_File, GDBM_File - various DBM implementations
26 This module is a "pure virtual base class"--it has nothing of its own.
27 It's just there to inherit from one of the various DBM packages. It
28 prefers ndbm for compatibility reasons with Perl 4, then Berkeley DB (See
29 L<DB_File>), GDBM, SDBM (which is always there--it comes with Perl), and
30 finally ODBM. This way old programs that used to use NDBM via dbmopen()
31 can still do so, but new ones can reorder @ISA:
33 @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File);
35 Note, however, that an explicit use overrides the specified order:
38 @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File);
40 will only find GDBM_File.
42 Having multiple DBM implementations makes it trivial to copy database formats:
44 use POSIX; use NDBM_File; use DB_File;
45 tie %newhash, 'DB_File', $new_filename, O_CREAT|O_RDWR;
46 tie %oldhash, 'NDBM_File', $old_filename, 1, 0;
49 =head2 DBM Comparisons
51 Here's a partial table of features the different packages offer:
53 odbm ndbm sdbm gdbm bsd-db
54 ---- ---- ---- ---- ------
55 Linkage comes w/ perl yes yes yes yes yes
56 Src comes w/ perl no no yes no no
57 Comes w/ many unix os yes yes[0] no no no
58 Builds ok on !unix ? ? yes yes ?
59 Code Size ? ? small big big
60 Database Size ? ? small big? ok[1]
61 Speed ? ? slow ok fast
62 FTPable no no yes yes yes
63 Easy to build N/A N/A yes yes ok[2]
64 Size limits 1k 4k 1k[3] none none
65 Byte-order independent no no no no yes
66 Licensing restrictions ? ? no yes no
73 on mixed universe machines, may be in the bsd compat library,
74 which is often shunned.
78 Can be trimmed if you compile for one access method.
83 Requires symbolic links.
87 By default, but can be redefined.
93 dbm(3), ndbm(3), DB_File(3)