diff options
author | Craig A. Berry <craigberry@mac.com> | 2007-10-06 18:28:59 +0000 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2007-10-06 18:28:59 +0000 |
commit | 617299157e790993f5e44437d5a60d79f697645c (patch) | |
tree | f4221d65b2c40010139e4c2dbc929e6894524986 /lib/Cwd.pm | |
parent | c4db126b6e2732a51225d9d720364b1178c8ec7b (diff) | |
download | perl-617299157e790993f5e44437d5a60d79f697645c.tar.gz |
Add symlink support to Cwd::_vms_abs_path.
p4raw-id: //depot/perl@32053
Diffstat (limited to 'lib/Cwd.pm')
-rw-r--r-- | lib/Cwd.pm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Cwd.pm b/lib/Cwd.pm index a4ef00c8db..2053f052bd 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -171,7 +171,7 @@ use strict; use Exporter; use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION); -$VERSION = '3.25'; +$VERSION = '3.25_01'; @ISA = qw/ Exporter /; @EXPORT = qw(cwd getcwd fastcwd fastgetcwd); @@ -644,11 +644,19 @@ sub _vms_cwd { sub _vms_abs_path { return $ENV{'DEFAULT'} unless @_; + my $path = shift; - # may need to turn foo.dir into [.foo] - my $path = VMS::Filespec::pathify($_[0]); - $path = $_[0] unless defined $path; + if (-l $path) { + my $link_target = readlink($path); + die "Can't resolve link $path: $!" unless defined $link_target; + + return _vms_abs_path($link_target); + } + # may need to turn foo.dir into [.foo] + my $pathified = VMS::Filespec::pathify($path); + $path = $pathified if defined $pathified; + return VMS::Filespec::rmsexpand($path); } |