Subject: | DBM::Deep doesn't isolate read/write from -l on the commandline |
DBM::Deep returns incorrect values when -l is present on the commandline.
Tested with DBM::Deep 0.982 and perl 5.8.6 on linux.
See the attached test based on one of the tests in the distro.
It probably requires $\ to be localised around read/writes to the DB.
local $\ = undef;
John.
--
Subject: | 29_commandline.t |
#!/usr/bin/perl -l
##
# DBM::Deep Test
#
# Test for interference from -l on the commandline.
##
use strict;
use Test::More tests => 4;
use Test::Exception;
use_ok( 'DBM::Deep' );
unlink "t/test.db";
my $db = DBM::Deep->new( "t/test.db" );
if ($db->error()) {
die "ERROR: " . $db->error();
}
##
# put/get key
##
$db->{key1} = "value1";
is( $db->get("key1"), "value1", "get() works with hash assignment" );
is( $db->fetch("key1"), "value1", "... fetch() works with hash assignment" );
is( $db->{key1}, "value1", "... and hash-access also works" );