AnyDBM_File.pdf

(20 KB) Pobierz
Perl version 5.10.0 documentation - AnyDBM_File
NAME
AnyDBM_File - provide framework for multiple DBMs
NDBM_File, DB_File, GDBM_File, SDBM_File, ODBM_File - various DBM implementations
SYNOPSIS
use AnyDBM_File;
DESCRIPTION
This module is a "pure virtual base class"--it has nothing of its own. It's just there to inherit from one of
the various 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
---- ----
----
----
Linkage comes w/ perl
yes
Src comes w/ perl
no
Comes w/ many unix os
yes
Builds ok on !unix
?
Code Size
?
Database Size
?
Speed
?
FTPable
no
Easy to build
N/A
Size limits
1k
Byte-order independent no
Licensing restrictions ?
[0]
on mixed universe machines, may be in the bsd compat library, which is often shunned.
[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.
ndbm
------
yes
no
yes[0]
?
?
?
?
no
N/A
4k
no
?
sdbm
yes
yes
no
yes
small
small
slow
yes
yes
1k[3]
no
no
gdbm
yes
no
no
yes
big
big?
ok
yes
yes
none
no
yes
bsd-db
yes
no
no
?
big
ok[1]
fast
yes
ok[2]
none
yes
no
http://perldoc.perl.org
Page 1
Perl version 5.10.0 documentation - AnyDBM_File
SEE ALSO
dbm(3), ndbm(3), DB_File(3),
perldbmfilter
http://perldoc.perl.org
Page 2
Zgłoś jeśli naruszono regulamin