1 package File::Spec::VMS;
5 require File::Spec::Unix;
6 @ISA = qw(File::Spec::Unix);
13 File::Spec::VMS - methods for VMS file specs
17 require File::Spec::VMS; # Done internally by File::Spec if needed
21 See File::Spec::Unix for a documentation of the methods provided
22 there. This package overrides the implementation of these methods, not
25 =head2 Methods always loaded
31 Concatenates a list of file specifications, and returns the result as a
32 VMS-syntax directory specification.
37 my ($self,@dirs) = @_;
39 @dirs = grep($_,@dirs);
42 my $path = (@dirs == 1 ? $dirs[0] : $self->catdir(@dirs));
43 my ($spath,$sdir) = ($path,$dir);
44 $spath =~ s/.dir$//; $sdir =~ s/.dir$//;
45 $sdir = $self->eliminate_macros($sdir) unless $sdir =~ /^[\w\-]+$/;
46 $rslt = $self->fixpath($self->eliminate_macros($spath)."/$sdir",1);
49 if ($dir =~ /^\$\([^\)]+\)$/) { $rslt = $dir; }
50 else { $rslt = vmspath($dir); }
57 Concatenates a list of file specifications, and returns the result as a
58 VMS-syntax directory specification.
63 my ($self,@files) = @_;
64 my $file = pop @files;
65 @files = grep($_,@files);
68 my $path = (@files == 1 ? $files[0] : $self->catdir(@files));
71 if ($spath =~ /^[^\)\]\/:>]+\)$/ && basename($file) eq $file) {
72 $rslt = "$spath$file";
75 $rslt = $self->eliminate_macros($spath);
76 $rslt = vmsify($rslt.($rslt ? '/' : '').unixify($file));
79 else { $rslt = vmsify($file); }
83 =item curdir (override)
85 Returns a string representation of the current directory: '[]'
93 =item devnull (override)
95 Returns a string representation of the null device: '_NLA0:'
103 =item rootdir (override)
105 Returns a string representation of the root directory: 'SYS$DISK:[000000]'
110 return 'SYS$DISK:[000000]';
113 =item tmpdir (override)
115 Returns a string representation of the first writable directory
116 from the following list or '' if none are writable:
125 return $tmpdir if defined $tmpdir;
126 foreach ('/sys$scratch', $ENV{TMPDIR}) {
127 next unless defined && -d && -w _;
131 $tmpdir = '' unless defined $tmpdir;
135 =item updir (override)
137 Returns a string representation of the parent directory: '[-]'
145 =item path (override)
147 Translate logical name DCL$PATH as a searchlist, rather than trying
148 to C<split> string value of C<$ENV{'PATH'}>.
154 while ($dir = $ENV{'DCL$PATH;' . $i++}) { push(@dirs,$dir); }
158 =item file_name_is_absolute (override)
160 Checks for VMS directory spec as well as Unix separators.
164 sub file_name_is_absolute {
165 my ($self,$file) = @_;
166 # If it's a logical name, expand it.
167 $file = $ENV{$file} while $file =~ /^[\w\$\-]+$/ && $ENV{$file};
168 return scalar($file =~ m!^/! ||
169 $file =~ m![<\[][^.\-\]>]! ||