in reply to Re: WhichDBM_File?
in thread WhichDBM_File?

I guess I phrased the question poorly. I'm not after the version number of any particular DBM module; but rather I need to know which DBM module a particular installation of Perl uses by default if you don't specify one.

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

    I misunderstood. perrin has it right. Here's what I used on 5.6.1, but I don't have a 5.5 to try it on.

    #!/usr/bin/perl -wl use strict; no strict 'refs'; # Nothing there yet! print "AnyDBM_File::ISA = ", @AnyDBM_File::ISA; dbmopen my %db, "foo", 0777; my $pkg = ref tied %db; print $pkg; my @isa = @{"${pkg}::ISA"}; print @isa; print ${"$isa[0]::VERSION"} __END__ AnyDBM_File::ISA = AnyDBM_File SDBM_File 1.03
      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.

        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.