Re: [patch@32376] VMS symbolic links part 4 of 4 - Final part
authorJohn E. Malmberg <wb8tyw@qsl.net>
Mon, 26 Nov 2007 23:35:30 +0000 (17:35 -0600)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 29 Nov 2007 10:00:26 +0000 (10:00 +0000)
From: "John E. Malmberg" <wb8tyw@qsl.net>
Message-id: <474BACA2.5060702@qsl.net>

p4raw-id: //depot/perl@32550

lib/File/Spec/VMS.pm

index 0802a03..968754d 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use vars qw(@ISA $VERSION);
 require File::Spec::Unix;
 
-$VERSION = '1.4_01';
+$VERSION = '3.25_02';
 
 @ISA = qw(File::Spec::Unix);
 
@@ -36,6 +36,8 @@ Removes redundant portions of file specifications according to VMS syntax.
 sub canonpath {
     my($self,$path) = @_;
 
+    return undef unless defined $path;
+
     if ($path =~ m|/|) { # Fake Unix
       my $pathify = $path =~ m|/\Z(?!\n)|;
       $path = $self->SUPER::canonpath($path);
@@ -260,6 +262,8 @@ Split dirspec using VMS syntax.
 
 sub splitdir {
     my($self,$dirspec) = @_;
+    my @dirs = ();
+    return @dirs if ( (!defined $dirspec) || ('' eq $dirspec) );
     $dirspec =~ tr/<>/[]/;                     # < and >       ==> [ and ]
     $dirspec =~ s/\]\[\./\.\]\[/g;             # ][.           ==> .][
     $dirspec =~ s/\[000000\.\]\[/\[/g;         # [000000.][    ==> [
@@ -275,7 +279,7 @@ sub splitdir {
                                                # [--]          ==> [-.-]
     $dirspec = "[$dirspec]" unless $dirspec =~ /[\[<]/; # make legal
     $dirspec =~ s/^(\[|<)\./$1/;
-    my(@dirs) = split /(?<!\^)\./, vmspath($dirspec);
+    @dirs = split /(?<!\^)\./, vmspath($dirspec);
     $dirs[0] =~ s/^[\[<]//s;  $dirs[-1] =~ s/[\]>]\Z(?!\n)//s;
     @dirs;
 }