Fix #14957.
[p5sagit/p5-mst-13.2.git] / ext / DB_File / t / db-btree.t
index eebbf86..74b0cba 100755 (executable)
@@ -1,8 +1,5 @@
 #!./perl -w
 
-use warnings;
-use strict;
-
 BEGIN {
     unless(grep /blib/, @INC) {
         chdir 't' if -d 't';
@@ -10,12 +7,14 @@ BEGIN {
     }
 }
  
+use warnings;
+use strict;
 use Config;
  
 BEGIN {
     if(-d "lib" && -f "TEST") {
         if ($Config{'extensions'} !~ /\bDB_File\b/ ) {
-            print "1..163\n";
+            print "1..0 # Skip: DB_File was not built\n";
             exit 0;
         }
     }
@@ -157,6 +156,7 @@ ok(18, $@ =~ /^DB_File::BTREEINFO::FETCH - Unknown element 'fred' at/ ) ;
 
 my ($X, %h) ;
 ok(19, $X = tie(%h, 'DB_File',$Dfile, O_RDWR|O_CREAT, 0640, $DB_BTREE )) ;
+die "Could not tie: $!" unless $X;
 
 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
    $blksize,$blocks) = stat($Dfile);
@@ -526,9 +526,9 @@ $dbh3->{compare} = sub { length $_[0] <=> length $_[1] } ;
  
  
 my (%g, %k);
-tie(%h, 'DB_File',$Dfile1, O_RDWR|O_CREAT, 0640, $dbh1 ) ; 
-tie(%g, 'DB_File',$Dfile2, O_RDWR|O_CREAT, 0640, $dbh2 ) ;
-tie(%k, 'DB_File',$Dfile3, O_RDWR|O_CREAT, 0640, $dbh3 ) ;
+tie(%h, 'DB_File',$Dfile1, O_RDWR|O_CREAT, 0640, $dbh1 ) or die $!;
+tie(%g, 'DB_File',$Dfile2, O_RDWR|O_CREAT, 0640, $dbh2 ) or die $!;
+tie(%k, 'DB_File',$Dfile3, O_RDWR|O_CREAT, 0640, $dbh3 ) or die $!;
  
 my @Keys = qw( 0123 12 -1234 9 987654321 def  ) ;
 my (@srt_1, @srt_2, @srt_3);
@@ -620,7 +620,7 @@ unlink $Dfile1 ;
 
    use warnings ;
    use strict ;
-   use vars qw( @ISA @EXPORT) ;
+   our (@ISA, @EXPORT);
 
    require Exporter ;
    use DB_File;
@@ -958,7 +958,7 @@ EOM
     use strict ;
     use DB_File ;
 
-    use vars qw($filename %h ) ;
+    my ($filename, %h);
 
     $filename = "tree" ;
     unlink $filename ;
@@ -1010,7 +1010,7 @@ EOM
     use strict ;
     use DB_File ;
  
-    use vars qw($filename $x %h $status $key $value) ;
+    my ($filename, $x, %h, $status, $key, $value);
 
     $filename = "tree" ;
     unlink $filename ;
@@ -1066,7 +1066,7 @@ EOM
     use strict ;
     use DB_File ;
  
-    use vars qw($filename $x %h ) ;
+    my ($filename, $x, %h);
 
     $filename = "tree" ;
  
@@ -1115,9 +1115,9 @@ EOM
     use strict ;
     use DB_File ;
  
-    use vars qw($filename $x %h $found) ;
+    my ($filename, $x, %h, $found);
 
-    my $filename = "tree" ;
+    $filename = "tree" ;
  
     # Enable duplicate records
     $DB_BTREE->{'flags'} = R_DUP ;
@@ -1150,9 +1150,9 @@ EOM
     use strict ;
     use DB_File ;
  
-    use vars qw($filename $x %h $found) ;
+    my ($filename, $x, %h, $found);
 
-    my $filename = "tree" ;
+    $filename = "tree" ;
  
     # Enable duplicate records
     $DB_BTREE->{'flags'} = R_DUP ;
@@ -1186,7 +1186,7 @@ EOM
     use DB_File ;
     use Fcntl ;
 
-    use vars qw($filename $x %h $st $key $value) ;
+    my ($filename, $x, %h, $st, $key, $value);
 
     sub match
     {