1N/Apackage AnyDBM_File;
1N/A
1N/Ause 5.006_001;
1N/Aour $VERSION = '1.00';
1N/Aour @ISA = qw(NDBM_File DB_File GDBM_File SDBM_File ODBM_File) unless @ISA;
1N/A
1N/Amy $mod;
1N/Afor $mod (@ISA) {
1N/A if (eval "require $mod") {
1N/A @ISA = ($mod); # if we leave @ISA alone, warnings abound
1N/A return 1;
1N/A }
1N/A}
1N/A
1N/Adie "No DBM package was successfully found or installed";
1N/A#return 0;
1N/A
1N/A=head1 NAME
1N/A
1N/AAnyDBM_File - provide framework for multiple DBMs
1N/A
1N/ANDBM_File, DB_File, GDBM_File, SDBM_File, ODBM_File - various DBM implementations
1N/A
1N/A=head1 SYNOPSIS
1N/A
1N/A use AnyDBM_File;
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/AThis module is a "pure virtual base class"--it has nothing of its own.
1N/AIt's just there to inherit from one of the various DBM packages. It
1N/Aprefers ndbm for compatibility reasons with Perl 4, then Berkeley DB (See
1N/AL<DB_File>), GDBM, SDBM (which is always there--it comes with Perl), and
1N/Afinally ODBM. This way old programs that used to use NDBM via dbmopen()
1N/Acan still do so, but new ones can reorder @ISA:
1N/A
1N/A BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File) }
1N/A use AnyDBM_File;
1N/A
1N/AHaving multiple DBM implementations makes it trivial to copy database formats:
1N/A
1N/A use POSIX; use NDBM_File; use DB_File;
1N/A tie %newhash, 'DB_File', $new_filename, O_CREAT|O_RDWR;
1N/A tie %oldhash, 'NDBM_File', $old_filename, 1, 0;
1N/A %newhash = %oldhash;
1N/A
1N/A=head2 DBM Comparisons
1N/A
1N/AHere's a partial table of features the different packages offer:
1N/A
1N/A odbm ndbm sdbm gdbm bsd-db
1N/A ---- ---- ---- ---- ------
1N/A Linkage comes w/ perl yes yes yes yes yes
1N/A Src comes w/ perl no no yes no no
1N/A Comes w/ many unix os yes yes[0] no no no
1N/A Builds ok on !unix ? ? yes yes ?
1N/A Code Size ? ? small big big
1N/A Database Size ? ? small big? ok[1]
1N/A Speed ? ? slow ok fast
1N/A FTPable no no yes yes yes
1N/A Easy to build N/A N/A yes yes ok[2]
1N/A Size limits 1k 4k 1k[3] none none
1N/A Byte-order independent no no no no yes
1N/A Licensing restrictions ? ? no yes no
1N/A
1N/A
1N/A=over 4
1N/A
1N/A=item [0]
1N/A
1N/Aon mixed universe machines, may be in the bsd compat library,
1N/Awhich is often shunned.
1N/A
1N/A=item [1]
1N/A
1N/ACan be trimmed if you compile for one access method.
1N/A
1N/A=item [2]
1N/A
1N/ASee L<DB_File>.
1N/ARequires symbolic links.
1N/A
1N/A=item [3]
1N/A
1N/ABy default, but can be redefined.
1N/A
1N/A=back
1N/A
1N/A=head1 SEE ALSO
1N/A
1N/Adbm(3), ndbm(3), DB_File(3), L<perldbmfilter>
1N/A
1N/A=cut