perl5.001 patch.1f
[p5sagit/p5-mst-13.2.git] / pod / modpods / AnyDBMFile.pod
1 =head1 NAME
2
3 AnyDBM_File - provide framework for multiple DBMs
4
5 NDBM_File, ODBM_File, SDBM_File, GDBM_File - various DBM implementations
6
7 =head1 SYNOPSIS
8
9     use AnyDBM_File;
10
11 =head1 DESCRIPTION
12
13 This module is a "pure virtual base class"--it has nothing of its own.
14 It's just there to inherit from one of the various DBM packages.  It
15 prefers ndbm for compatibility reasons with Perl 4, then Berkeley DB (See
16 L<DB_File>), GDBM, SDBM (which is always there--it comes with Perl), and
17 finally ODBM.   This way old programs that used to use NDBM via dbmopen()
18 can still do so, but new ones can reorder @ISA:
19
20     @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File);
21
22 Note, however, that an explicit use overrides the specified order:
23
24     use GDBM_File;
25     @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File);
26
27 will only find GDBM_File.
28
29 Having multiple DBM implementations makes it trivial to copy database formats:
30
31     use POSIX; use NDBM_File; use DB_File;
32     tie %newhash,  DB_File, $new_filename, O_CREAT|O_RDWR;
33     tie %oldhash,  NDBM_File, $old_filename, 1, 0;
34     %newhash = %oldhash;
35
36 =head2 DBM Comparisons
37
38 Here's a partial table of features the different packages offer:
39
40                          odbm    ndbm    sdbm    gdbm    bsd-db
41                          ----    ----    ----    ----    ------
42  Linkage comes w/ perl   yes     yes     yes     yes     yes
43  Src comes w/ perl       no      no      yes     no      no
44  Comes w/ many unix os   yes     yes[0]  no      no      no
45  Builds ok on !unix      ?       ?       yes     yes     ?
46  Code Size               ?       ?       small   big     big
47  Database Size           ?       ?       small   big?    ok[1]
48  Speed                   ?       ?       slow    ok      fast
49  FTPable                 no      no      yes     yes     yes
50  Easy to build          N/A     N/A      yes     yes     ok[2]
51  Size limits             1k      4k      1k[3]   none    none
52  Byte-order independent  no      no      no      no      yes
53  Licensing restrictions  ?       ?       no      yes     no
54
55
56 =over 4
57
58 =item [0] 
59
60 on mixed universe machines, may be in the bsd compat library,
61 which is often shunned.
62
63 =item [1] 
64
65 Can be trimmed if you compile for one access method.
66
67 =item [2] 
68
69 See L<DB_File>. 
70 Requires symbolic links.  
71
72 =item [3] 
73
74 By default, but can be redefined.
75
76 =back
77
78 =head1 SEE ALSO
79
80 dbm(3), ndbm(3), DB_File(3)