8
unless(grep /blib/, @INC) {
10
@INC = '../lib' if -d '../lib';
15
use File::Path qw(rmtree);
19
if ($BerkeleyDB::db_version < 3) {
20
print "1..0 # Skipped - this needs Berkeley DB 3.x or better\n" ;
50
print "not " unless $result ;
58
open(CAT,$file) || die "Cannot open $file:$!";
65
my $Dfile = "dbhash.tmp";
73
ok 1, -d $home ? chmod 0777, $home : mkdir($home, 0777) ;
74
mkdir "./fred", 0777 ;
76
ok 2, my $env = new BerkeleyDB::Env -Flags => DB_CREATE ;
77
ok 3, $env->set_mutexlocks(0) == 0 ;
87
my $lex = new LexFile $Dfile ;
90
ok 4, my $db = new BerkeleyDB::Hash -Filename => $Dfile,
101
while (($k, $v) = each %data) {
102
$ret += $db->db_put($k, $v) ;
107
ok 6, my $cursor = $db->db_cursor() ;
109
# point to a specific k/v pair
111
ok 7, $cursor->c_get($k, $v, DB_SET) == 0 ;
112
ok 8, $v eq "house" ;
114
# duplicate the cursor
115
my $dup_cursor = $cursor->c_dup(DB_POSITION);
118
# move original cursor off green/house
119
$cursor->c_get($k, $v, DB_NEXT) ;
120
ok 10, $k ne "green" ;
121
ok 11, $v ne "house" ;
123
# duplicate cursor should still be on green/house
124
ok 12, $dup_cursor->c_get($k, $v, DB_CURRENT) == 0;
125
ok 13, $k eq "green" ;
126
ok 14, $v eq "house" ;