in reply to Re: Re: Re: WhichDBM_File?
in thread WhichDBM_File?

Nice script! I used it on both systems and got, on mine (Perl 5.8):
AnyDBM_File::ISA = AnyDBM_File NDBM_File 1.04
On my hosting service (Perl 5.005), I got:
AnyDBM_File::ISA = AnyDBM_File NDBM_File 1.01
That's a version difference of only 0.03. So the puzzle remains as to why they produce such different files and how I can reconcile the two.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: WhichDBM_File?
by TilRMan (Friar) on Apr 20, 2004 at 06:53 UTC

    Disclaimer: My experience with Perl's dbm is quite limited.

    My guess is that they are using different versions of the ndbm backend, though the interface stays the same to Perl. Does ndbm guarantee to be portable across systems anyway?

    I can't tell from your post what the constraints of "reconciling" are. The only sure-fire way I know is to rewrite to use a different storage mechanism. Perhaps Storable or Data::Dumper might be of use.

      "Reconciling" can occur on a couple different levels:
      1. Identical scripts work identically on both systems, even though the actual data storage may be different.
      2. Files created on one system are interchangable with those on the other.
      Number one is an issue right now because of a short-sighted decision I made several years ago. That was to apply locking to the actual datafiles, rather than to separate lockfiles. Not smart because, to do so, I have to know the name of the data file. And now they're different between the two systems. Oops! That may be easy to remedy, though.

      Number two is harder, because I've got archival data I'd just as soon not have to recreate just to accomodate a different DBM. I suppose some sort of conversion routine might not be out of the question, however.

        1. sounds (potentially) like a recipee for a race codition (see perldoc DB_File), but it's easily solvable (use a sempahore aka lockfile).

        2. You've already got the data, just dump it in a platform independant form (should be trivial).

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.