Here are some miscellaneous VMS specific things that need to be fixed for VMS to work with the VMS C Run-Time Library (CRTL) UNIX filename mode that do not require any other changes to Perl for implementation.

When the VMS CRTL is in UNIX filename mode, the VMS C library calls return filenames in UNIX format.

Sorry if I got the case of some of the filenames wrong. I tried to get them right.

t/op/anonsub.t :
t/op/closure.t :
t/op/lex_assign.t :
t/op/runlevel.t :
t/lib/warnings/doio :
lib/Test/Harness/Straps.pm :

Remove 'MCR'. It is not needed, and it breaks Perl when the VMS CRTL is in UNIX filename mode. PERL on VMS usually knows when to add the MCR command and how to handle $^X as either a VMS or UNIX file specification.


lib/vmsish.t:
vms/ext/Stdio/test.pl:

MCR is still needed in these cases, but must make sure that $^X is a VMS file specification if MCR is prefixing it.


utils/c2ph.pl :

VMS now supports LINK, but still uses a different filename. Since link is configured, the link routine is expected to succeed. Note that not all file systems on VMS support the link(), but we are assuming that if someone built a binary with link(), they are building on a file system with link support on.


t/op/chdir.t

Clean up SYS$LOGIN after this script is run out side of the test harness. A bit strange to exit a script and find the pointer to the login directory gone.


t/op/stat.t

Perl could find a /bin/ls on VMS but not really know how to run it yet, resulting in some interesting test failures.


t/x2p/s2p.t

RMSEXPAND needs a VMS format file specification. When the VMS CRTL is in UNIX filename mode, these additional vmsify() commands are needed.


t/pod/find.t

VMS could be in a UNIX filename mode, so if you want a filename in VMS format, it needs to be converted.

-John
[EMAIL PROTECTED]
Personal Opinion Only
--- t/op/anonsub.t_blead        Mon Aug  1 21:04:15 2005
+++ t/op/anonsub.t      Mon Aug  1 21:04:22 2005
@@ -32,7 +32,7 @@
     print TEST "$prog\n";
     close TEST or die "Could not close: $!";
     my $results = $Is_VMS ?
-               `MCR $^X "-I[-.lib]" $switch $tmpfile 2>&1` :
+               `$^X "-I[-.lib]" $switch $tmpfile 2>&1` :
                  $Is_MSWin32 ?
                    `.\\perl -I../lib $switch $tmpfile 2>&1` :
                      $Is_MacOS ?  
--- utils/c2ph.pl       Mon Aug  1 22:15:46 2005
+++ utils/c2ph.pl_blead Mon Aug  1 22:12:34 2005
@@ -1437,7 +1437,7 @@
 unlink 'pstruct';
 print "Linking c2ph to pstruct.\n";
 if (defined $Config{d_link}) {
-  link $file, 'pstruct';
+  link 'c2ph', 'pstruct';
 } else {
   unshift @INC, '../lib';
   require File::Copy;
--- t/op/chdir.t_blead  Mon Aug  1 22:24:46 2005
+++ t/op/chdir.t        Mon Aug  1 22:24:24 2005
@@ -138,6 +138,10 @@
 
     # Restore the environment for VMS (and doesn't hurt for anyone else)
     @[EMAIL PROTECTED] = @[EMAIL PROTECTED];
+
+    # On VMS this must be deleted or process table is wrong on exit
+    # when this script is run interactively.
+    delete $ENV{'SYS$LOGIN'} if $IsVMS;
 }
 
 
--- t/op/closure.t_blead        Mon Aug  1 22:30:08 2005
+++ t/op/closure.t      Mon Aug  1 22:30:14 2005
@@ -466,7 +466,7 @@
            my $errfile = "terr$$";  $errfile++ while -e $errfile;
            my @tmpfiles = ($cmdfile, $errfile);
            open CMD, ">$cmdfile"; print CMD $code; close CMD;
-           my $cmd = (($^O eq 'VMS') ? "MCR $^X"
+           my $cmd = (($^O eq 'VMS') ? "$^X"
                       : ($^O eq 'MSWin32') ? '.\perl'
                       : ($^O eq 'MacOS') ? $^X
                       : ($^O eq 'NetWare') ? 'perl'
--- t_lib_warnings_doio.blead   Mon Aug  1 22:39:42 2005
+++ t/lib/warnings/doio.        Mon Aug  1 22:40:25 2005
@@ -60,10 +60,10 @@
 __END__
 # doio.c [Perl_do_open9]
 use warnings 'io' ;
-open(F, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
+open(F, '|'."$^X -e 1|");
 close(F);
 no warnings 'io' ;
-open(G, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
+open(G, '|'."$^X -e 1|");
 close(G);
 EXPECT
 Can't open bidirectional pipe at - line 3.
--- t/op/lex_assign.t_blead     Mon Aug  1 22:52:28 2005
+++ t/op/lex_assign.t   Mon Aug  1 22:52:34 2005
@@ -8,7 +8,7 @@
 $| = 1;
 umask 0;
 $xref = \ "";
-$runme = ($^O eq 'VMS' ? 'MCR ' : '') . $^X;
+$runme = $^X;
 @a = (1..5);
 %h = (1..6);
 $aref = [EMAIL PROTECTED];
--- t/op/runlevel.t_blead       Mon Aug  1 23:01:00 2005
+++ t/op/runlevel.t     Mon Aug  1 23:01:22 2005
@@ -34,7 +34,7 @@
     print TEST "$prog\n";
     close TEST or die "Could not close: $!";
     my $results = $Is_VMS ?
-                      `MCR $^X "-I[-.lib]" $switch $tmpfile 2>&1` :
+                      `$^X "-I[-.lib]" $switch $tmpfile 2>&1` :
                  $Is_MSWin32 ?  
                      `.\\perl -I../lib $switch $tmpfile 2>&1` :
                  $Is_NetWare ?  
--- t/x2p/s2p.t_blead   Mon Aug  1 23:09:15 2005
+++ t/x2p/s2p.t Mon Aug  1 23:09:20 2005
@@ -791,6 +791,8 @@
 my $psed = File::Spec->catfile( File::Spec->curdir(), 'psed' );
 if ($^O eq 'VMS') {
   # default in the .com extenson if it's not already there
+  $s2p = VMS::Filespec::vmsify($s2p);
+  $psed = VMS::Filespec::vmsify($psed);
   $s2p = VMS::Filespec::rmsexpand($s2p, '.com');
   $psed = VMS::Filespec::rmsexpand($psed, '.com');
 }
--- t/op/stat.t_blead   Mon Aug  1 23:23:31 2005
+++ t/op/stat.t Mon Aug  1 23:23:37 2005
@@ -49,6 +49,8 @@
 open(FOO, ">$tmpfile") || DIE("Can't open temp test file: $!");
 
 my($nlink, $mtime, $ctime) = (stat(FOO))[$NLINK, $MTIME, $CTIME];
+
+#VMS Fix-me: nlink should work on VMS if applicable link support configured.
 SKIP: {
     skip "No link count", 1 if $Is_VMS;
 
@@ -212,6 +214,16 @@
     skip "Skipping: unexpected ls output in MP-RAS", 6
       if $Is_MPRAS;
 
+    # VMS problem:  If GNV or other UNIX like tool is installed, then
+    # sometimes Perl will find /bin/ls, and will try to run it.
+    # But since Perl on VMS does not know to run it under Bash, it will
+    # try to run the DCL verb LS.  And if the VMS product Language
+    # Sensitive Editor is installed, or some other LS verb, that will
+    # be run instead.  So do not do this until we can teach Perl
+    # when to use BASH on VMS.
+    skip "ls command not available to Perl in OpenVMS right now.", 6
+      if $Is_VMS;
+
     my $LS  = $Config{d_readlink} ? "ls -lL" : "ls -l";
     my $CMD = "$LS /dev 2>/dev/null";
     my $DEV = qx($CMD);
--- lib/Test/Harness/Straps.pm_blead    Mon Aug  1 23:31:55 2005
+++ lib/Test/Harness/Straps.pm  Mon Aug  1 23:33:07 2005
@@ -356,7 +356,6 @@
     my $self = shift;
 
     return $ENV{HARNESS_PERL}           if defined $ENV{HARNESS_PERL};
-    return "MCR $^X"                    if $self->{_is_vms};
     return Win32::GetShortPathName($^X) if $self->{_is_win32};
     return $^X;
 }
--- t/pod/find.t_blead  Mon Aug  1 23:41:10 2005
+++ t/pod/find.t        Mon Aug  1 23:41:16 2005
@@ -88,6 +88,7 @@
 
 require Config;
 if ($^O eq 'VMS') { # privlib is perl_root:[lib] OK but not under mms
+    $result = VMS::Filespec::vmsify($result); #if you want VMS you need to 
force it.
     $compare = "lib.File]Find.pm";
     $result =~ s/perl_root:\[\-?\.?//i;
     $result =~ s/\[\-?\.?//i; # needed under `mms test`
--- lib/vmsish.t_blead  Mon Aug  1 23:49:20 2005
+++ lib/vmsish.t        Mon Aug  1 23:54:27 2005
@@ -5,7 +5,10 @@
     @INC = '../lib'; 
 }
 
-my $Invoke_Perl = qq(MCR $^X "-I[-.lib]");
+my $perl = $^X;
+$perl = VMS::Filespec::vmsify($perl) if $^O eq 'VMS';
+
+my $Invoke_Perl = qq(MCR $perl "-I[-.lib]");
 
 require "./test.pl";
 plan(tests => 25);
--- vms/ext/Stdio/test.pl_blead Tue Aug  2 00:04:50 2005
+++ vms/ext/Stdio/test.pl       Tue Aug  2 00:05:39 2005
@@ -5,6 +5,10 @@
 print "1..18\n";
 print +(defined(&getname) ? '' : 'not '), "ok 1\n";
 
+#VMS can pretend that it is UNIX.
+my $perl = $^X;
+$perl = VMS::Filespec::vmsify($perl) if $^O eq 'VMS';
+
 $name = "test$$";
 $name++ while -e "$name.tmp";
 $fh = VMS::Stdio::vmsopen("+>$name",'ctx=rec','shr=put','fop=dlt','dna=.tmp');
@@ -28,6 +32,11 @@
 print +($line eq localtime($time) ? '' : 'not '), "ok 9\n";
 
 ($gotname) = (getname($fh) =~/\](.*);/);
+
+#we may be in UNIX emulation mode.
+if (!defined($gotname)) {
+   ($gotname) = (VMS::Filespec::vmsify(getname($fh)) =~/\](.*)/);
+}
 print +("\U$gotname" eq "\U$name.tmp" ? '' : 'not '), "ok 10\n";
 
 $sfh = VMS::Stdio::vmssysopen($name, O_RDONLY, 0,
@@ -43,7 +52,7 @@
 
 print +(&VMS::Stdio::tmpnam ? '' : 'not '),"ok 14\n";
 
-#if (open(P, qq[| MCR $^X -e "1 while (<STDIN>);print 'Foo';1 while (<STDIN>); 
print 'Bar'" >$name.tmp])) {
+#if (open(P, qq[| $^X -e "1 while (<STDIN>);print 'Foo';1 while (<STDIN>); 
print 'Bar'" >$name.tmp])) {
 #  print P "Baz\nQuux\n";
 #  print +(VMS::Stdio::writeof(P) ? '' : 'not '),"ok 15\n";
 #  print P "Baz\nQuux\n";
@@ -59,7 +68,7 @@
 #}
 
 $sfh = VMS::Stdio::vmsopen(">$name.tmp");
-$setuperl = "\$ MCR $^X\nBEGIN { [EMAIL PROTECTED] = qw(@INC) };\nuse 
VMS::Stdio qw(&setdef);";
+$setuperl = "\$ MCR $perl\nBEGIN { [EMAIL PROTECTED] = qw(@INC) };\nuse 
VMS::Stdio qw(&setdef);";
 print $sfh qq[\$ here = F\$Environment("Default")\n];
 print $sfh "$setuperl\nsetdef();\n\$ Show Default\n\$ Set Default 'here'\n";
 print $sfh "$setuperl\nsetdef('..');\n\$ Show Default\n";

Reply via email to