Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Seeking DBM wisdom

by jreades (Friar)
on Dec 05, 2000 at 00:11 UTC ( [id://44846]=note: print w/replies, xml ) Need Help??


in reply to Seeking DBM wisdom

The dbmopen() documentation offers some tantalizing clues:

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).
You can control which DBM library you use by loading that library before you call dbmopen()

What this suggests is that dbmopen() will, by default, attempt to open the dbm file using the ndbm library. If that attempt fails, then dbmopen() falls back on the SDBM lib. By process of deduction, it seems likely that the first HUPX box did not support the ndbm-style dbm files, while the second one did.

Thus, calls on the first box fell back automagically on sdbm while calls on the second succeeded in using ndbm to open the files, it just happened to dump a good bit of your data.

Well, I don't know if that's the case, but it sounds good don't it?

Either case, I'd suggest switching the application over to tie() as the dbm functions are largely deprecated (and harder to use).

Replies are listed 'Best First'.
Re: Re: Seeking DBM wisdom
by wardk (Deacon) on Dec 05, 2000 at 00:56 UTC
    thank you jreades. my dbmopen doc appears to be a bit dated...it doesn't have "in older versions of ..." text, here what I was reading.
    See also L<AnyDBM_File> for a more general description of the pros and
    cons of the various dbm approaches, as well as L<DB_File> for a particularly
    rich implementation.
    
    You can control which DBM library you use by loading that library
    before you call dbmopen():
        use DB_File;
        dbmopen(%NS_Hist, "$ENV{HOME}/.netscape/history.db")
            or die "Can't open netscape history file: $!";
    

    I had tried the above, but DB_File.pm is not installed.

    I finally found a pointer to the "use SDBM_File" by rooting through some ActiveState docs.

    I am not sure that this fully explains why it ran from the web, but not commandline on the original box, must be environmental issues involved as well. Perhaps NBDM is installed, just doesn't appear that way from the CGI script?

    On switching to tie(), I fully agree. Part of my testing provided my co-worker with an alternative version to hers using tie(), but in recently looking at the source, she appears to be sticking with dbmopen(). I know when I showed the code using tie(), she indicated she wasn't ready to start tackling yet-another-new-concept. One dragon at a time...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://44846]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found