When you used "regular dbm(open|close)", did you also happen to have "use GDBM_File;" ? Or not? If not, then you were probably using some default dbm library other than GDBM, and maybe there was a problem with how your GDBM library and/or GDBM_File module were installed.

(According to perldoc -f dbmopen -- at least in my 5.8.1 version -- you can say "use SOMEDBM_File;" in combination with dbmopen, in order to override whatever dbm library was designated as the default when your perl was installed.)

But if the default dbm library works for you, all you need to do is find out what that is and check that it's available in all the places where you want your code to be portable to. Here's a one-liner to find out the default:

perl -MAnyDBM_File -e 'print $AnyDBM_File::ISA[0],$/'

I get "NDBM_File" on macosx/perl-5.8.1, freebsd/perl-5.8.6 and solaris/perl-5.8.0 -- and since NDBM, like GDBM, is not byte-order dependent, it seems like a safe choice (unless the 4K limit on record size is an issue for you, which it probably isn't).

(minor update to fix grammar; also noticed that NDBM was also the default on 5.005_03 perl on solaris)


In reply to Re: Strange GDBM behavior by graff
in thread Strange GDBM behavior by wink

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.