[PATCH] Re: VMS UNIX mode fixes submitted for 02AutoSplit.t

[email protected] (Steffen Mueller)
Newsgroups perl.perl5.porters,perl.vmsperl
Message-ID <[email protected]>
Hi John, hi all,

John Malmberg wrote:
> https://rt.cpan.org/Ticket/Display.html?id=42137
> 
> Fixes submitted for running tests when VMS is a UNIX compatible mode.

thanks for the ticket and patch. I just applied your change to the CPAN 
AutoLoader distribution and made an AutoLoader 5.68 release which is on 
its way to CPAN now.

The attached patch updates AutoLoader.pm to the new version and adjusts 
the 02AutoSplit.t test file according the patch in RT. It applies 
cleanly with patch -p0 to whatever revision of perl I got via rsync.

I'm sorry it's not using the new git hotness. At some point I'll just 
have to spend the time to get a working knowledge of it, but not today.

Best regards,
Steffen
AutoLoader-5.68.diff (text/x-diff, 2 KB)
--- lib/AutoLoader/t/02AutoSplit.t	2008-12-19 10:14:10.000000000 +0100
+++ lib/AutoLoader/t/02AutoSplit.t	2009-01-05 16:10:48.000000000 +0100
@@ -26,6 +26,31 @@
 use File::Spec;
 use File::Find;
 
+my $Is_VMS   = $^O eq 'VMS';
+my $Is_VMS_mode = 0;
+my $Is_VMS_lc = 0;
+
+if ($Is_VMS) {
+    require VMS::Filespec if $Is_VMS;
+    my $vms_unix_rpt;
+    my $vms_case;
+
+    $Is_VMS_mode = 1;
+    $Is_VMS_lc = 1;
+    if (eval 'require VMS::Feature') {
+        $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
+        $vms_case = VMS::Feature::current("efs_case_preserve");
+    } else {
+        my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
+        my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || '';
+        $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; 
+        $vms_case = $efs_case =~ /^[ET1]/i;
+    }
+    $Is_VMS_lc = 0 if ($vms_case);
+    $Is_VMS_mode = 0 if ($vms_unix_rpt);
+}
+
+
 require AutoSplit; # Run time. Check it compiles.
 ok (1, "AutoSplit loaded");
 
@@ -72,7 +97,7 @@
 
 my $i = 0;
 my $dir = File::Spec->catdir($incdir, 'auto');
-if ($^O eq 'VMS') {
+if ($Is_VMS_mode) {
   $dir = VMS::Filespec::unixify($dir);
   $dir =~ s/\/$//;
 } elsif ($^O eq 'MacOS') {
@@ -109,7 +134,7 @@
     $output = split_a_file (undef, $file, $dir, @extra_args);
   }
 
-  if ($^O eq 'VMS') {
+  if ($Is_VMS_mode) {
      my ($filespec, $replacement);
      while ($output =~ m/(\[.+\])/) {
        $filespec = $1;
@@ -128,7 +153,7 @@
     find (sub {$got{$File::Find::name}++ unless -d $_}, $dir);
     foreach (split /\n/, $args{Files}) {
       next if /^#/;
-      $_ = lc($_) if $^O eq 'VMS';
+      $_ = lc($_) if $Is_VMS_lc;
       unless (delete $got{$_}) {
         $missing{$_}++;
       }
--- lib/AutoLoader.pm	2008-12-19 10:14:10.000000000 +0100
+++ lib/AutoLoader.pm	2009-01-05 16:18:47.000000000 +0100
@@ -15,7 +15,7 @@
     $is_epoc = $^O eq 'epoc';
     $is_vms = $^O eq 'VMS';
     $is_macos = $^O eq 'MacOS';
-    $VERSION = '5.67';
+    $VERSION = '5.68';
 }
 
 AUTOLOAD {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.