diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-05-06 15:37:30 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-05-06 15:37:30 +0000 |
commit | 605986241de3d828e4de2beec37dc9ecc5aaa260 (patch) | |
tree | 4e4c7758c4d45004e25d2c72a576e251302cd58b /lib/File | |
parent | 86d86cadad68b71393e3371f0e467c29982578f9 (diff) | |
download | perl-605986241de3d828e4de2beec37dc9ecc5aaa260.tar.gz |
Upgrade to PathTools 3.07
p4raw-id: //depot/perl@24407
Diffstat (limited to 'lib/File')
-rw-r--r-- | lib/File/Spec.pm | 11 | ||||
-rw-r--r-- | lib/File/Spec/Cygwin.pm | 3 | ||||
-rw-r--r-- | lib/File/Spec/Mac.pm | 3 | ||||
-rw-r--r-- | lib/File/Spec/OS2.pm | 3 | ||||
-rw-r--r-- | lib/File/Spec/Unix.pm | 10 | ||||
-rw-r--r-- | lib/File/Spec/VMS.pm | 3 | ||||
-rw-r--r-- | lib/File/Spec/Win32.pm | 6 | ||||
-rw-r--r-- | lib/File/Spec/t/Spec.t | 1 |
8 files changed, 26 insertions, 14 deletions
diff --git a/lib/File/Spec.pm b/lib/File/Spec.pm index 7cb7192188..0c5c0c02f3 100644 --- a/lib/File/Spec.pm +++ b/lib/File/Spec.pm @@ -3,7 +3,7 @@ package File::Spec; use strict; use vars qw(@ISA $VERSION); -$VERSION = '3.05'; +$VERSION = '3.07'; $VERSION = eval $VERSION; my %module = (MacOS => 'Mac', @@ -13,7 +13,7 @@ my %module = (MacOS => 'Mac', epoc => 'Epoc', NetWare => 'Win32', # Yes, File::Spec::Win32 works on NetWare. symbian => 'Win32', # Yes, File::Spec::Win32 works on symbian. - dos => 'OS2', # Yes, File::Spec::OS2 works on DJGPP. + dos => 'OS2', # Yes, File::Spec::OS2 works on DJGPP. cygwin => 'Cygwin'); @@ -89,6 +89,13 @@ path. $cpath = File::Spec->canonpath( $path ) ; +Note that this does *not* collapse F<x/../y> sections into F<y>. This +is by design. If F</foo> on your system is a symlink to F</bar/baz>, +then F</foo/../quux> is actually F</bar/quux>, not F</quux> as a naive +F<../>-removal would give you. If you want to do this kind of +processing, you probably want C<Cwd>'s C<realpath()> function to +actually traverse the filesystem cleaning up paths like this. + =item catdir Concatenate two or more directory names to form a complete path ending diff --git a/lib/File/Spec/Cygwin.pm b/lib/File/Spec/Cygwin.pm index e01e03537a..19a2937c6b 100644 --- a/lib/File/Spec/Cygwin.pm +++ b/lib/File/Spec/Cygwin.pm @@ -76,8 +76,7 @@ variables are tainted, they are not used. my $tmpdir; sub tmpdir { return $tmpdir if defined $tmpdir; - my $self = shift; - $tmpdir = $self->_tmpdir( $ENV{TMPDIR}, "/tmp", 'C:/temp' ); + $tmpdir = $_[0]->_tmpdir( $ENV{TMPDIR}, "/tmp", 'C:/temp' ); } =back diff --git a/lib/File/Spec/Mac.pm b/lib/File/Spec/Mac.pm index e31737ca71..81016b3090 100644 --- a/lib/File/Spec/Mac.pm +++ b/lib/File/Spec/Mac.pm @@ -373,8 +373,7 @@ directory on your startup volume. my $tmpdir; sub tmpdir { return $tmpdir if defined $tmpdir; - my $self = shift; - $tmpdir = $self->_tmpdir( $ENV{TMPDIR} ); + $tmpdir = $_[0]->_tmpdir( $ENV{TMPDIR} ); } =item updir diff --git a/lib/File/Spec/OS2.pm b/lib/File/Spec/OS2.pm index 9f2ca3c5a4..ec308f3b6f 100644 --- a/lib/File/Spec/OS2.pm +++ b/lib/File/Spec/OS2.pm @@ -37,8 +37,7 @@ sub _cwd { my $tmpdir; sub tmpdir { return $tmpdir if defined $tmpdir; - my $self = shift; - $tmpdir = $self->_tmpdir( @ENV{qw(TMPDIR TEMP TMP)}, + $tmpdir = $_[0]->_tmpdir( @ENV{qw(TMPDIR TEMP TMP)}, '/tmp', '/' ); } diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm index 46158bddd9..47ad797fca 100644 --- a/lib/File/Spec/Unix.pm +++ b/lib/File/Spec/Unix.pm @@ -30,6 +30,13 @@ path. On UNIX eliminates successive slashes and successive "/.". $cpath = File::Spec->canonpath( $path ) ; +Note that this does *not* collapse F<x/../y> sections into F<y>. This +is by design. If F</foo> on your system is a symlink to F</bar/baz>, +then F</foo/../quux> is actually F</bar/quux>, not F</quux> as a naive +F<../>-removal would give you. If you want to do this kind of +processing, you probably want C<Cwd>'s C<realpath()> function to +actually traverse the filesystem cleaning up paths like this. + =cut sub canonpath { @@ -151,8 +158,7 @@ sub _tmpdir { sub tmpdir { return $tmpdir if defined $tmpdir; - my $self = shift; - $tmpdir = $self->_tmpdir( $ENV{TMPDIR}, "/tmp" ); + $tmpdir = $_[0]->_tmpdir( $ENV{TMPDIR}, "/tmp" ); } =item updir diff --git a/lib/File/Spec/VMS.pm b/lib/File/Spec/VMS.pm index e085e0a63d..887746bbe1 100644 --- a/lib/File/Spec/VMS.pm +++ b/lib/File/Spec/VMS.pm @@ -297,8 +297,7 @@ is tainted, it is not used. my $tmpdir; sub tmpdir { return $tmpdir if defined $tmpdir; - my $self = shift; - $tmpdir = $self->_tmpdir( 'sys$scratch:', $ENV{TMPDIR} ); + $tmpdir = $_[0]->_tmpdir( 'sys$scratch:', $ENV{TMPDIR} ); } =item updir (override) diff --git a/lib/File/Spec/Win32.pm b/lib/File/Spec/Win32.pm index e5d38102d7..f2b8c391e5 100644 --- a/lib/File/Spec/Win32.pm +++ b/lib/File/Spec/Win32.pm @@ -35,6 +35,9 @@ sub devnull { return "nul"; } +sub rootdir () { '\\' } + + =item tmpdir Returns a string representation of the first existing directory @@ -60,8 +63,7 @@ variables are tainted, they are not used. my $tmpdir; sub tmpdir { return $tmpdir if defined $tmpdir; - my $self = shift; - $tmpdir = $self->_tmpdir( @ENV{qw(TMPDIR TEMP TMP)}, + $tmpdir = $_[0]->_tmpdir( @ENV{qw(TMPDIR TEMP TMP)}, 'SYS:/temp', 'C:\system\temp', 'C:/temp', diff --git a/lib/File/Spec/t/Spec.t b/lib/File/Spec/t/Spec.t index 565eb8c213..85d580ca96 100644 --- a/lib/File/Spec/t/Spec.t +++ b/lib/File/Spec/t/Spec.t @@ -118,6 +118,7 @@ if ($^O eq 'MacOS') { [ "Unix->rel2abs('/t1','/t1/t2/t3')", '/t1' ], [ "Win32->case_tolerant()", '1' ], +[ "Win32->rootdir()", '\\' ], [ "Win32->splitpath('file')", ',,file' ], [ "Win32->splitpath('\\d1/d2\\d3/')", ',\\d1/d2\\d3/,' ], |