RE: [ID 20001013.009] DB_File issues warning when setting element to undef
[p5sagit/p5-mst-13.2.git] / t / lib / db-recno.t
index 18fb45b..f932a89 100755 (executable)
@@ -99,7 +99,7 @@ sub bad_one
 EOM
 }
 
-print "1..126\n";
+print "1..127\n";
 
 my $Dfile = "recno.tmp";
 unlink $Dfile ;
@@ -836,4 +836,26 @@ EOM
    
 }
 
+{
+    # Bug ID 20001013.009
+    #
+    # test that $hash{KEY} = undef doesn't produce the warning
+    #     Use of uninitialized value in null operation 
+    use warnings ;
+    use strict ;
+    use DB_File ;
+
+    unlink $Dfile;
+    my @h ;
+    my $a = "";
+    local $SIG{__WARN__} = sub {$a = $_[0]} ;
+    
+    tie @h, 'DB_File', $Dfile,  O_RDWR|O_CREAT, 0664, $DB_RECNO 
+       or die "Can't open file: $!\n" ;
+    $h[0] = undef;
+    ok(127, $a eq "") ;
+    untie @h;
+    unlink $Dfile;
+}
+
 exit ;