DB_File
[please cc: as I'm still waiting on subscribe confirmation from the list server]
I upgraded one of my Testing machines so it now has Perl 5.8.0.[1]
For some reason DB_File is not working like I expect, so I'm wondering
what changed. I'm hoping I'm missing something obvious, which is often the case...
Here's my test script:
#!/usr/bin/perl -w
use strict;
use DB_File;
my %hash;
my $obj = tie %hash, 'DB_File', 'Workshops.db';
warn $! unless $obj;
print "$_\n" for keys %hash;
And here's info from two machines to show I'm testing with the same file:
$ md5sum Workshops.db
2d7f22e3404b9c0d5c50b20bbc232a91 Workshops.db
$md5sum Workshops.db
2d7f22e3404b9c0d5c50b20bbc232a91 Workshops.db
And on the Stable machine running Perl 5.6.1:
$perl t.pl | head
8
39
13
26
57
And on the Testing machine with Perl 5.8.0:
$ perl t.pl
File exists at t.pl line 9.
But I don't get any output. db_dump does seem to work.
$ db_dump -d Workshops.db | head -20
hash (local mpool, read-only)
magic 0x61561
version 5
pagesize 8192
ovfl_point 3
last_freed 0
max_bucket 4
high_mask 0x7
low_mask 0x3
ffactor 0
nelem 137
h_charkey 0x5e688dd1
0 0 48 131 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
page 1: (hash)
lsn.file: 0 lsn.offset: 0
prev: 0 next: 0 entries: 34 offset: 2283
[000] 8190 8
[001] 5279 len: 2910 data: Law on the 'Net: A W...
[002] 5276 len: 2 data: 39
Here's packages on the working machine running Perl 5.6.1.
$dpkg -l | fgrep -i berkeley
ii libdb2 2.7.7.0-7 The Berkeley database routines (run-time fil
ii libdb2++ 2.7.7.0-7 The Berkeley database routines (c++ run-time
ii libdb2-util 2.7.7.0-7 The Berkeley database routines (development
ii libdb3 3.2.9-16 Berkeley v3 Database Libraries [runtime]
ii libdb3++ 3.2.9-16 Berkeley v3 Database Libraries for C++ [runt
ii libdb3++-dev 3.2.9-16 Berkeley v3 Database Libraries for C++ [deve
ii libdb3-dev 3.2.9-16 Berkeley v3 Database Libraries [development]
ii libdb3-util 3.2.9-16 Berkeley v3 Database Utilities
And on the non-working Testing machine.
$ dpkg -l | grep -i berkeley
ii libdb1-compat 2.1.3-7 The Berkeley database routines [glibc 2.0/2.
ii libdb2 2.7.7.0-8 The Berkeley database routines (run-time fil
ii libdb2-util 2.7.7.0-8 The Berkeley database routines (development
ii libdb3 3.2.9-17 Berkeley v3 Database Libraries [runtime]
ii libdb4.0 4.0.14-1.2 Berkeley v4.0 Database Libraries [runtime]
ii libdb4.1 4.1.25-4 Berkeley v4.1 Database Libraries [runtime]
[1] Some day I'd like to learn how to gracefully update without loss of
CPAN-installed modules...
--
Bill Moseley
moseley@hank.org
Reply to: