"Fossies" - the Fresh Open Source Software Archive

Member "install-tl-20200916/tlpkg/tlperl/lib/AnyDBM_File.pm" (20 Nov 2012, 2618 Bytes) of package /windows/misc/install-tl.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 package AnyDBM_File;
    2 use warnings;
    3 use strict;
    4 
    5 use 5.006_001;
    6 our $VERSION = '1.01';
    7 our @ISA = qw(NDBM_File DB_File GDBM_File SDBM_File ODBM_File) unless @ISA;
    8 
    9 my $mod;
   10 for $mod (@ISA) {
   11     if (eval "require $mod") {
   12     @ISA = ($mod);  # if we leave @ISA alone, warnings abound
   13     return 1;
   14     }
   15 }
   16 
   17 die "No DBM package was successfully found or installed";
   18 
   19 __END__
   20 
   21 =head1 NAME
   22 
   23 AnyDBM_File - provide framework for multiple DBMs
   24 
   25 NDBM_File, DB_File, GDBM_File, SDBM_File, ODBM_File - various DBM implementations
   26 
   27 =head1 SYNOPSIS
   28 
   29     use AnyDBM_File;
   30 
   31 =head1 DESCRIPTION
   32 
   33 This module is a "pure virtual base class"--it has nothing of its own.
   34 It's just there to inherit from one of the various DBM packages.  It
   35 prefers ndbm for compatibility reasons with Perl 4, then Berkeley DB (See
   36 L<DB_File>), GDBM, SDBM (which is always there--it comes with Perl), and
   37 finally ODBM.   This way old programs that used to use NDBM via dbmopen()
   38 can still do so, but new ones can reorder @ISA:
   39 
   40     BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File) }
   41     use AnyDBM_File;
   42 
   43 Having multiple DBM implementations makes it trivial to copy database formats:
   44 
   45     use Fcntl; use NDBM_File; use DB_File;
   46     tie %newhash,  'DB_File', $new_filename, O_CREAT|O_RDWR;
   47     tie %oldhash,  'NDBM_File', $old_filename, 1, 0;
   48     %newhash = %oldhash;
   49 
   50 =head2 DBM Comparisons
   51 
   52 Here's a partial table of features the different packages offer:
   53 
   54                          odbm    ndbm    sdbm    gdbm    bsd-db
   55              ----    ----    ----    ----    ------
   56  Linkage comes w/ perl   yes     yes     yes     yes     yes
   57  Src comes w/ perl       no      no      yes     no      no
   58  Comes w/ many unix os   yes     yes[0]  no      no      no
   59  Builds ok on !unix      ?       ?       yes     yes     ?
   60  Code Size               ?       ?       small   big     big
   61  Database Size           ?       ?       small   big?    ok[1]
   62  Speed                   ?       ?       slow    ok      fast
   63  FTPable                 no      no      yes     yes     yes
   64  Easy to build          N/A     N/A      yes     yes     ok[2]
   65  Size limits             1k      4k      1k[3]   none    none
   66  Byte-order independent  no      no      no      no      yes
   67  Licensing restrictions  ?       ?       no      yes     no
   68 
   69 
   70 =over 4
   71 
   72 =item [0] 
   73 
   74 on mixed universe machines, may be in the bsd compat library,
   75 which is often shunned.
   76 
   77 =item [1] 
   78 
   79 Can be trimmed if you compile for one access method.
   80 
   81 =item [2] 
   82 
   83 See L<DB_File>. 
   84 Requires symbolic links.  
   85 
   86 =item [3] 
   87 
   88 By default, but can be redefined.
   89 
   90 =back
   91 
   92 =head1 SEE ALSO
   93 
   94 dbm(3), ndbm(3), DB_File(3), L<perldbmfilter>
   95 
   96 =cut