[blead-227-gbd2db5d] ext/File/Gob/t/basic.t, ext/POSIX/t/posix.t vms fixes

[email protected] (John Malmberg)
Newsgroups perl.perl5.porters,perl.vmsperl
Message-ID <[email protected]>
The tests ext/File/Glob/t/basic.t and ext/POSIX/t/posix.t need to know 
if VMS is in the UNIX compatible mode.

I could not find any maintainers listed for these.

-John
[email protected]
Personal Opinion Only
ext_file_glob_t_basic_t.gdiff (text/plain, 1.1 KB)
--- /rsync_root/perl/ext/File/Glob/t/basic.t	Mon Apr 14 06:47:31 2008
+++ ext/File/Glob/t/Basic.t	Sun Nov 23 16:35:04 2008
@@ -19,6 +19,23 @@
 BEGIN {use_ok('File::Glob', ':glob')};
 use Cwd ();
 
+my $vms_unix_rpt = 0;
+my $vms_efs = 0;
+my $vms_mode = 0;
+if ($^O eq 'VMS') {
+    if (eval 'require VMS::Feature') {
+        $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
+        $vms_efs = VMS::Feature::current("efs_charset");
+    } else {
+        my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
+        my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
+        $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; 
+        $vms_efs = $efs_charset =~ /^[ET1]/i; 
+    }
+    $vms_mode = 1 unless ($vms_unix_rpt);
+}
+
+
 # look for the contents of the current directory
 $ENV{PATH} = "/bin";
 delete @ENV{qw(BASH_ENV CDPATH ENV IFS)};
@@ -109,7 +126,7 @@
 
 print "# @a\n";
 
-is_deeply(\@a, [($^O eq 'VMS'? 'test.' : 'TEST'), 'a', 'b']);
+is_deeply(\@a, [($vms_mode ? 'test.' : 'TEST'), 'a', 'b']);
 
 # "~" should expand to $ENV{HOME}
 $ENV{HOME} = "sweet home";
ext_posix_t_posix_t.gdiff (text/plain, 1.3 KB)
--- /rsync_root/perl/ext/POSIX/t/posix.t	Thu Aug 16 06:16:44 2007
+++ ext/POSIX/t/posix.t	Sun Nov 23 18:19:34 2008
@@ -28,6 +28,28 @@
 $Is_UWin    = $^O eq 'uwin';
 $Is_OS390   = $^O eq 'os390';
 
+my $vms_unix_rpt = 0;
+my $vms_efs = 0;
+my $unix_mode = 1;
+
+if ($Is_VMS) {
+    $unix_mode = 0;
+    if (eval 'require VMS::Feature') {
+        $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
+        $vms_efs = VMS::Feature::current("efs_charset");
+    } else {
+        my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
+        my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
+        $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; 
+        $vms_efs = $efs_charset =~ /^[ET1]/i; 
+    }
+
+    # Traditional VMS mode only if VMS is not in UNIX compatible mode.
+    $unix_mode = ($vms_efs && $vms_unix_rpt);
+
+}
+
+
 ok( $testfd = open("TEST", O_RDONLY, 0),        'O_RDONLY with open' );
 read($testfd, $buffer, 4) if $testfd > 2;
 is( $buffer, "#!./",                      '    with read' );
@@ -128,11 +150,11 @@
 if ($Is_MacOS) {
     $pat = qr/:t:$/;
 } 
-elsif ( $Is_VMS ) {
-    $pat = qr/\.T]/i;
+elsif ( $unix_mode ) {
+    $pat = qr#[\\/]t$#i;
 }
 else {
-    $pat = qr#[\\/]t$#i;
+    $pat = qr/\.T]/i;
 }
 like( getcwd(), qr/$pat/, 'getcwd' );
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.