The patch below gets DBI 1.32 to build and pass all tests with Perl 5.8.0 on OpenVMS Alpha 7.3-1. With Perl 5.6.1 there are some minor issues remaining (noted below). The changes are as follows:

The Makefile.PL is modified to avoid undefined values warnings for certain items fetched from %Config.

The post_initialize method in the Makefile.PL is modified to account for the fact that File::Find::find returns '.' for the current directory under 5.6.1 but the more idiomatic '[]' under 5.8.0. This was causing various important extras to be missed when building under 5.8.0.

The t/06attrs.t test has been modified to make the matching of 'No such file ...' messages case insensitive since on VMS those come out as 'no such file ...'.

This one is not a VMS issue per se but came up in my testing. The t/10examp.t test would fail when run on a system with minimal access controls and when not running with excessive privileges. Specifically it would use File::Spec->rootdir and children as its private sandbox. I changed this to File::Spec->updir so at least it is only looking at the sibling directories of the DBI build directory and their children.

The t/40profile.t test has been modified to close the log file before checking its size; otherwise the file is more than likely still in cache and registers a size of zero.

With Perl 5.6.1, the following tests still fail for the following reasons:

t/10examp.t -- different semantics for -T on shebang line
t/40profile.t -- Time::HiRes not in the core before 5.8.0

It may also be worth posting a reminder here that when building DBI on VMS with Perl 5.6.1 or earlier, it is necessary to specify an explicit target ('all' or 'test' will do). Otherwise only the first target gets built, which is DBI's custom post_constants section. In Perl 5.8.0, MakeMaker has been fixed to build the 'all' target regardless of whether other targets appear before it.

Thanks to Stephen Smith, whose detailed comments on his recent experience building DBI saved me some time in tracking down test failures.


--- Makefile.PL;-0      Sun Dec  1 16:36:57 2002
+++ Makefile.PL Sun Jan 19 15:41:06 2003
@@ -155,6 +155,11 @@
 my ( $cfg_privlibexp, $cfg_archlibexp, $cfg_sitelibexp, $cfg_sitearchexp,
      $cfg_man3direxp ) =
      @Config{qw( privlibexp archlibexp sitelibexp sitearchexp man3direxp ) };
+for ( $cfg_privlibexp, $cfg_archlibexp, $cfg_sitelibexp, $cfg_sitearchexp,
+     $cfg_man3direxp ) {
+     $_ = '' unless defined $_;
+}
+
 
 $Verbose = $::opt_v;
 WriteMakefile(
@@ -233,6 +238,10 @@
 
     # install files that DBD's may need
     File::Find::find( sub {
+
+       # may be '.' or '[]' depending on File::Find version
+       $_ = '.' if $^O eq 'VMS' && $_ eq File::Spec->curdir;
+
        $File::Find::prune = 1, return if -d $_ && '.' ne $_;
        $self->{PM}->{$_} = File::Spec->catfile($self->{INST_ARCHAUTODIR}, $_)
            if '.h' eq substr( $_, -2 ) || '.xst' eq substr( $_, -4 );
--- t/06attrs.t;-0      Mon Nov 25 17:20:03 2002
+++ t/06attrs.t Sat Jan 11 19:01:02 2003
@@ -98,10 +98,10 @@
 # Trigger an exception.
 eval { $sth->execute };
 ok( $err = $@ );
-ok( $err =~ /^DBD::ExampleP::st execute failed: opendir\(foo\): No such file or 
directory/ );
+ok( $err =~ /^DBD::ExampleP::st execute failed: opendir\(foo\): No such file or 
+directory/i );
 
 # Test all of the statement handle attributes.
-ok( $sth->errstr, 'opendir(foo): No such file or directory' );
+ok( $sth->errstr =~ m/^opendir\(foo\): No such file or directory/i );
 ok( $sth->state, 'S1000' );
 
 # booleans
--- t/10examp.t;-0      Sun Dec  1 16:36:54 2002
+++ t/10examp.t Sat Jan 11 22:15:34 2003
@@ -573,11 +573,11 @@
 
 print "dump_results\n";
 ok(0, $csr_a = $dbh->prepare($std_sql));
-if ($haveFileSpec && length(File::Spec->rootdir))
+if ($haveFileSpec && length(File::Spec->updir))
 {
-  ok(0, $csr_a->execute(File::Spec->rootdir));
+  ok(0, $csr_a->execute(File::Spec->updir));
 } else {
-  ok(0, $csr_a->execute('/'));
+  ok(0, $csr_a->execute('../'));
 }
 my $dump_dir = ($ENV{TMP} || $ENV{TEMP} || $ENV{TMPDIR} 
                || $ENV{'SYS$SCRATCH'} || '/tmp');
--- t/40profile.t;-0    Sun Dec  1 16:36:52 2002
+++ t/40profile.t       Sun Jan 19 17:19:34 2003
@@ -14,6 +14,7 @@
 
 use DBI;
 use DBI::Profile;
+use File::Spec;
 
 BEGIN {
     if ($DBI::PurePerl) {
@@ -32,7 +33,7 @@
 # log file to store profile results 
 my $LOG_FILE = "profile.log";
 DBI->trace(0, $LOG_FILE);
-END { unlink $LOG_FILE; }
+END { 1 while unlink $LOG_FILE; }
 
 # make sure profiling starts disabled
 my $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1 });
@@ -187,6 +188,7 @@
 }
 
 # check that output went into the log file
+DBI->trace(0, File::Spec->devnull); # close current log to flush it
 ok(-s $LOG_FILE);
 
 exit 0;


Reply via email to