DB_File 1.64 patch
[p5sagit/p5-mst-13.2.git] / t / lib / db-recno.t
index c2161b2..d5afeb0 100755 (executable)
@@ -1,7 +1,7 @@
 #!./perl -w
 
 BEGIN {
-    @INC = '../lib' if -d '../lib' ;
+    unshift @INC, '../lib' if -d '../lib' ;
     require Config; import Config;
     if ($Config{'extensions'} !~ /\bDB_File\b/) {
        print "1..0\n";
@@ -15,7 +15,17 @@ use strict ;
 use vars qw($dbh $Dfile $bad_ones $FA) ;
 
 # full tied array support started in Perl 5.004_57
-$FA = ($] >= 5.004_57) ;
+# Double check to see if it is available.
+
+{
+    sub try::TIEARRAY { bless [], "try" }
+    sub try::FETCHSIZE { $FA = 1 }
+    $FA = 0 ;
+    my @a ; 
+    tie @a, 'try' ;
+    my $a = @a ;
+}
+
 
 sub ok
 {
@@ -32,14 +42,16 @@ sub bad_one
 {
     print STDERR <<EOM unless $bad_ones++ ;
 #
-# Some older versions of Berkeley DB will fail tests 51, 53 and 55.
+# Some older versions of Berkeley DB version 1 will fail tests 51,
+# 53 and 55.
 #
 # You can safely ignore the errors if you're never going to use the
 # broken functionality (recno databases with a modified bval). 
 # Otherwise you'll have to upgrade your DB library.
 #
-# If you want to upgrade Berkeley DB, the most recent version is 1.85.
-# Check out http://www.bostic.com/db for more details.
+# If you want to use Berkeley DB version 1, then 1.85 and 1.86 are the
+# last versions that were released. Berkeley DB version 2 is continually
+# being updated -- Check out http://www.sleepycat.com/ for more details.
 #
 EOM
 }
@@ -96,8 +108,8 @@ my $X  ;
 my @h ;
 ok(17, $X = tie @h, 'DB_File', $Dfile, O_RDWR|O_CREAT, 0640, $DB_RECNO ) ;
 
-ok(18, ((stat($Dfile))[2] & 0777) == (($^O eq 'os2' || $^O eq 'MSWin32') ? 0666 : 0640)
-       || $^O eq 'amigaos') ;
+ok(18, ((stat($Dfile))[2] & 0777) == ($^O eq 'os2' ? 0666 : 0640)
+       ||  $^O eq 'MSWin32' || $^O eq 'amigaos') ;
 
 #my $l = @h ;
 my $l = $X->length ;