develooper Front page | perl.perl5.porters | Postings from August 2013

deprecate dbmopen/dbmclose

Thread Next
From:
H.Merijn Brand
Date:
August 16, 2013 12:45
Subject:
deprecate dbmopen/dbmclose
Message ID:
20130816144456.226bfa14@pc09.procura.nl
dbmopen and dbmclose are there just for backcompat and should not/never
be used:

   dbmopen HASH,DBNAME,MASK
       [This function has been largely superseded by the tie function.]

       This binds a dbm(3), ndbm(3), sdbm(3), gdbm(3), or Berkeley DB
       file to a hash. HASH is the name of the hash. (Unlike normal
       "open", the first argument is not a filehandle, even though it
       looks like one). DBNAME is the name of the database (without the
       .dir or .pag extension if any). If the database does not exist, it
       is created with protection specified by MASK (as modified by the
       "umask"). To prevent creation of the database if it doesn't exist,
       you may specify a MODE of 0, and the function will return a false
       value if it can't find an existing database. If your system
       supports only the older DBM functions, you may make only one
       "dbmopen" call in your program. In older versions of Perl, if your
       system had neither DBM nor ndbm, calling "dbmopen" produced a
       fatal error; it now falls back to sdbm(3).

There is a plethora or better alternatives in CORE and on CPAN, and
all docs should refer to tie DB_File instead, naming the alternatives
available in core as inferior possibilities.

As a side note, when dbmopen fails, there is no drop-in replacement.
When DB_File fails, there are a few drop-in replacements available
that might (or might not) work better/faster

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.19   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About