6
unless(grep /blib/, @INC) {
8
@INC = '../lib' if -d '../lib';
13
use File::Path qw(rmtree);
17
if ($BerkeleyDB::db_version < 3) {
18
print "1..0 # Skipping test, this needs Berkeley DB 3.x or better\n" ;
29
sub try::TIEARRAY { bless [], "try" }
30
sub try::FETCHSIZE { $FA = 1 }
60
print "not " unless $result ;
71
my $filename = shift ;
73
open ($fh, ">$filename") || die "Cannot open $filename: $!" ;
74
my $real_stdout = select($fh) ;
75
return bless [$fh, $real_stdout ] ;
90
open(CAT,$file) || die "Cannot open $file:$!";
91
my $result = <CAT> || "" ;
100
open(CAT,$file) || die "Cannot open $file: $!";
101
my $result = <CAT> || "" ;
107
my $Dfile = "dbhash.tmp";
108
my $Dfile2 = "dbhash2.tmp";
109
my $Dfile3 = "dbhash3.tmp";
114
my $redirect = "xyzt" ;
118
my $redirect = "xyzt" ;
121
my $redirectObj = new Redirect $redirect ;
126
my $filename = "fruit" ;
128
my $db = new BerkeleyDB::Hash
129
-Filename => $filename,
132
or die "Cannot open file $filename: $! $BerkeleyDB::Error\n" ;
134
# Add a few key/value pairs to the file
135
$db->db_put("red", "apple") ;
136
$db->db_put("orange", "orange") ;
137
$db->db_put("green", "banana") ;
138
$db->db_put("yellow", "banana") ;
139
$db->db_put("red", "tomato") ;
140
$db->db_put("green", "apple") ;
142
# print the contents of the file
143
my ($k, $v) = ("", "") ;
144
my $cursor = $db->db_cursor() ;
145
while ($cursor->c_get($k, $v, DB_NEXT) == 0)
146
{ print "$k -> $v\n" }
153
#print "[" . docat($redirect) . "]" ;
154
ok(1, docat_del($redirect) eq <<'EOM') ;
166
my $redirect = "xyzt" ;
169
my $redirectObj = new Redirect $redirect ;
174
my $filename = "fruit" ;
176
my $db = new BerkeleyDB::Hash
177
-Filename => $filename,
179
-Property => DB_DUP | DB_DUPSORT
180
or die "Cannot open file $filename: $! $BerkeleyDB::Error\n" ;
182
# Add a few key/value pairs to the file
183
$db->db_put("red", "apple") ;
184
$db->db_put("orange", "orange") ;
185
$db->db_put("green", "banana") ;
186
$db->db_put("yellow", "banana") ;
187
$db->db_put("red", "tomato") ;
188
$db->db_put("green", "apple") ;
190
# print the contents of the file
191
my ($k, $v) = ("", "") ;
192
my $cursor = $db->db_cursor() ;
193
while ($cursor->c_get($k, $v, DB_NEXT) == 0)
194
{ print "$k -> $v\n" }
201
#print "[" . docat($redirect) . "]" ;
202
ok(2, docat_del($redirect) eq <<'EOM') ;