From: Craig A. Berry Date: Thu, 22 Jul 2010 23:32:01 +0000 (-0500) Subject: Assorted File::Spec::VMS fixes. X-Git-Tag: accepted/trunk/20130322.191538~8352 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=385aae1cee12b4154e2b376fae4a7330017b7a50;p=platform%2Fupstream%2Fperl.git Assorted File::Spec::VMS fixes. - Make catpath return an empty directory rather than the current directory if the directory name is empty. This allows catpath to play nice with non-rooted logical names, as in catpath('sys$login:', '', 'login.com'); - Fix abs2rel bug in handling a Unix-style input. - Assorted clarification and simplification of the documentation. Also submitted upstream at: --- diff --git a/cpan/Cwd/lib/File/Spec/VMS.pm b/cpan/Cwd/lib/File/Spec/VMS.pm index f3c3905..6135fc5 100644 --- a/cpan/Cwd/lib/File/Spec/VMS.pm +++ b/cpan/Cwd/lib/File/Spec/VMS.pm @@ -26,34 +26,16 @@ See File::Spec::Unix for a documentation of the methods provided there. This package overrides the implementation of these methods, not the semantics. -The mode of operation of these routines depend on the VMS features that -are controlled by the DECC features C and -C. +The default behavior is to allow either VMS or Unix syntax on input and to +return VMS syntax on output, even when Unix syntax was given on input. -Perl needs to be at least at 5.10 for these feature settings to work. -Use of them on older perl versions on VMS will result in unpredictable -operations. - -The default and traditional mode of these routines have been to expect VMS -syntax on input and to return VMS syntax on output, even when Unix syntax was -given on input. - -The default and traditional mode is also incompatible with the VMS -C, Extended File system character set, and with running Perl scripts -under , Gnu is not VMS, an optional Unix like runtime environment on VMS. - -If the C feature is enabled, These routines will now accept -either VMS or UNIX syntax. If the input parameters are clearly VMS syntax, -the return value will be in VMS syntax. If the input parameters are clearly -in Unix syntax, the output will be in Unix syntax. - -This corresponds to the way that the VMS C library routines have always -handled filenames, and what a programmer who has not specifically read this -pod before would also expect. - -If the C feature is enabled, then if the output -syntax can not be determined from the input syntax, the output syntax will be -UNIX. If the feature is not enabled, VMS output will be the default. +When used with a Perl of version 5.10 or greater and a CRTL possessing the +relevant capabilities, override behavior depends on the CRTL features +C and C. When the +C feature is enabled and the input parameters are clearly +in Unix syntax, the output will be in Unix syntax. If +C is enabled and the output syntax cannot be +determined from the input syntax, the output will be in Unix syntax. =over 4 @@ -757,6 +739,7 @@ sub catpath { $dir = vmspath($dir); } } + $dir = '' if length($dev) && ($dir eq '[]' || $dir eq '<>'); "$dev$dir$file"; } @@ -774,11 +757,6 @@ sub abs2rel { my $efs = $self->_efs; my $unix_rpt = $self->_unix_rpt; - if (!$efs) { - return vmspath(File::Spec::Unix::abs2rel( $self, @_ )) - if grep m{/}, @_; - } - # We need to identify what the directory is in # of the specification in order to process them my $path_unix = 0; @@ -1039,7 +1017,7 @@ sub rel2abs { # # The traditional VMS mode using ODS-2 disks depends on these routines # being here. These routines should not be called in when the -# C or C modes are enabled. +# C or C modes are enabled. sub eliminate_macros { my($self,$path) = @_; @@ -1156,7 +1134,7 @@ See L and L. This package overrides the implementation of these methods, not the semantics. An explanation of VMS file specs can be found at -L<"http://h71000.www7.hp.com/doc/731FINAL/4506/4506pro_014.html#apps_locating_naming_files">. +L. =cut diff --git a/cpan/Cwd/t/Spec.t b/cpan/Cwd/t/Spec.t index 0c629bf..b4339ef 100644 --- a/cpan/Cwd/t/Spec.t +++ b/cpan/Cwd/t/Spec.t @@ -377,6 +377,7 @@ if ($^O eq 'MacOS') { [ "VMS->catpath('','d1/d2/d3','file')", $vms_efs ? 'd1/d2/d3/file' : '[.d1.d2.d3]file' ], [ "VMS->catpath('v','d1/d2/d3','file')", 'v:[.d1.d2.d3]file' ], +[ "VMS->catpath('v','','file')", 'v:file' ], [ "VMS->catpath('v','w:[d1.d2.d3]','file')", 'v:[d1.d2.d3]file' ], [ "VMS->catpath('node::volume:','[d1.d2.d3]','')", 'node::volume:[d1.d2.d3]' ], [ "VMS->catpath('node::volume:','[d1.d2.d3]','file')", 'node::volume:[d1.d2.d3]file' ],