B
Brian Greenfield
I've got a HoH which I'm trying to store using MLDBM and DB_File. The
following minimal script demonstrates the problem I've got.
Using an untied hash works ok:
|zippy:~/scripts$ ./test 0 # untied
|$VAR1 = {
| 'fruit' => {
| 'banana' => 1,
| 'apple' => 1,
| 'orange' => 1
| }
| };
But,
|zippy:~/scripts$ ./test 1 # tied
|Using tie
|$VAR1 = {
| 'fruit' => {}
| };
And the script:
|zippy:~/scripts$ cat test
|#!/usr/bin/perl
|
|use strict;
|use warnings FATAL=>'all';
|use Data:umper;
|use MLDBM qw/DB_File/;
|
|unlink "my.db";
|my $use_tie = shift || 0;
|my %db;
|
|if ($use_tie)
|{
| print "Using tie\n";
| tie %db, "MLDBM", 'my.db' or die "can't tie: $!";
|}
|
|$db{fruit}{$_} = 1 for qw/apple orange banana/;
|print Dumper \%db;
|untie %db;
Perl is 5.8.0 running on Debian/testing.
MLDBM is 2.01
DB_File is 1.804
and please don't ask which version of libdb I'm using
Any input appreciated.
following minimal script demonstrates the problem I've got.
Using an untied hash works ok:
|zippy:~/scripts$ ./test 0 # untied
|$VAR1 = {
| 'fruit' => {
| 'banana' => 1,
| 'apple' => 1,
| 'orange' => 1
| }
| };
But,
|zippy:~/scripts$ ./test 1 # tied
|Using tie
|$VAR1 = {
| 'fruit' => {}
| };
And the script:
|zippy:~/scripts$ cat test
|#!/usr/bin/perl
|
|use strict;
|use warnings FATAL=>'all';
|use Data:umper;
|use MLDBM qw/DB_File/;
|
|unlink "my.db";
|my $use_tie = shift || 0;
|my %db;
|
|if ($use_tie)
|{
| print "Using tie\n";
| tie %db, "MLDBM", 'my.db' or die "can't tie: $!";
|}
|
|$db{fruit}{$_} = 1 for qw/apple orange banana/;
|print Dumper \%db;
|untie %db;
Perl is 5.8.0 running on Debian/testing.
MLDBM is 2.01
DB_File is 1.804
and please don't ask which version of libdb I'm using
Any input appreciated.