This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: 5.10.0 test hangs on non internet access
[perl5.git] / vms / ext / Filespec.pm
index b0b1414..e0a179b 100644 (file)
@@ -1,8 +1,8 @@
 #   Perl hooks into the routines in vms.c for interconversion
 #   of VMS and Unix file specification syntax.
 #
-#   Version:  1.1
-#   Author:   Charles Bailey  bailey@genetics.upenn.edu
+#   Version:  see $VERSION below
+#   Author:   Charles Bailey  bailey@newman.upenn.edu
 #   Revised:  08-Mar-1995
 
 =head1 NAME
@@ -128,6 +128,7 @@ This document was last revised 22-Feb-1996, for Perl 5.002.
 package VMS::Filespec;
 require 5.002;
 
+our $VERSION = '1.11';
 
 # If you want to use this package on a non-VMS system,
 # uncomment the following line.
@@ -179,6 +180,7 @@ sub rmsexpand ($;$) {
   ($node,$dev,$dir,$name,$type,$ver) = $fspec =~
      /([^:]*::)?([^:]*:)?([^>\]]*[>\]])?([^.;]*)(\.?[^.;]*)([.;]?\d*)/;
   foreach ((@$defaults,$ENV{'DEFAULT'})) {
+    next unless defined;
     last if $node && $ver && $type && $dev && $dir && $name;
     ($dnode,$ddev,$ddir,$dname,$dtype,$dver) =
        /([^:]*::)?([^:]*:)?([^>\]]*[>\]])?([^.;]*)(\.?[^.;]*)([.;]?\d*)/;
@@ -266,6 +268,7 @@ sub fileify ($) {
   my($path) = @_;
 
   if (!$path) { return undef }
+  if ($path eq '/') { return 'sys$disk:[000000]'; }
   if ($path =~ /(.+)\.([^:>\]]*)$/) {
     $path = $1;
     if ($2 !~ /^dir(?:;1)?$/i) { return undef }
@@ -337,7 +340,7 @@ sub candelete ($) {
   return '' unless -w $fspec;
   $fspec =~ s#/$##;
   if ($fspec =~ m#/#) {
-    ($parent = $fspec) =~ s#/[^/]+$#;
+    ($parent = $fspec) =~ s#/[^/]+$##;
     return (-w $parent);
   }
   elsif ($parent = fileify($fspec)) { # fileify() here to expand lnms