summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-11-23 03:09:08 +0000
committerSteve Peters <steve@fisharerojo.org>2006-11-23 03:09:08 +0000
commite9475de8c2ea6600ed3517594b1793ffd3a89f27 (patch)
treef9ef3dc4cd8ef37c4833e4d0a103ac2ac6ea1684 /lib
parentd6a9eb89513c8810816fb51d1ad3f1e7f7ad29ff (diff)
downloadperl-e9475de8c2ea6600ed3517594b1793ffd3a89f27.tar.gz
Upgrade to PathTools-3.24.
p4raw-id: //depot/perl@29356
Diffstat (limited to 'lib')
-rw-r--r--lib/Cwd.pm6
-rw-r--r--lib/File/Spec.pm2
-rw-r--r--lib/File/Spec/Cygwin.pm8
-rw-r--r--lib/File/Spec/Unix.pm19
4 files changed, 21 insertions, 14 deletions
diff --git a/lib/Cwd.pm b/lib/Cwd.pm
index c8b3602b52..70aa8110bf 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.23';
+$VERSION = '3.24';
@ISA = qw/ Exporter /;
@EXPORT = qw(cwd getcwd fastcwd fastgetcwd);
@@ -479,7 +479,9 @@ sub chdir {
return 1;
}
- if ($newdir =~ m#^/#s) {
+ if (ref $newdir eq 'GLOB') { # in case a file/dir handle is passed in
+ $ENV{'PWD'} = cwd();
+ } elsif ($newdir =~ m#^/#s) {
$ENV{'PWD'} = $newdir;
} else {
my @curdir = split(m#/#,$ENV{'PWD'});
diff --git a/lib/File/Spec.pm b/lib/File/Spec.pm
index ee6138cffa..28379abf76 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.23';
+$VERSION = '3.24';
$VERSION = eval $VERSION;
my %module = (MacOS => 'Mac',
diff --git a/lib/File/Spec/Cygwin.pm b/lib/File/Spec/Cygwin.pm
index be457b1620..7124706059 100644
--- a/lib/File/Spec/Cygwin.pm
+++ b/lib/File/Spec/Cygwin.pm
@@ -40,7 +40,13 @@ and then File::Spec::Unix canonpath() is called on the result.
sub canonpath {
my($self,$path) = @_;
$path =~ s|\\|/|g;
- return $self->SUPER::canonpath($path);
+
+ # Handle network path names beginning with double slash
+ my $node = '';
+ if ( $path =~ s@^(//[^/]+)(?:/|\z)@/@s ) {
+ $node = $1;
+ }
+ return $node . $self->SUPER::canonpath($path);
}
sub catdir {
diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm
index 6cec7577aa..5674731167 100644
--- a/lib/File/Spec/Unix.pm
+++ b/lib/File/Spec/Unix.pm
@@ -43,13 +43,12 @@ sub canonpath {
my ($self,$path) = @_;
# Handle POSIX-style node names beginning with double slash (qnx, nto)
- # Handle network path names beginning with double slash (cygwin)
# (POSIX says: "a pathname that begins with two successive slashes
# may be interpreted in an implementation-defined manner, although
# more than two leading slashes shall be treated as a single slash.")
my $node = '';
- my $double_slashes_special = $self->isa("File::Spec::Cygwin") || $^O =~ m/^(?:qnx|nto)$/;
- if ( $double_slashes_special && $path =~ s:^(//[^/]+)(/|\z):/:s ) {
+ my $double_slashes_special = $^O eq 'qnx' || $^O eq 'nto';
+ if ( $double_slashes_special && $path =~ s{^(//[^/]+)(?:/|\z)}{/}s ) {
$node = $1;
}
# This used to be
@@ -57,12 +56,12 @@ sub canonpath {
# but that made tests 29, 30, 35, 46, and 213 (as of #13272) to fail
# (Mainly because trailing "" directories didn't get stripped).
# Why would cygwin avoid collapsing multiple slashes into one? --jhi
- $path =~ s|/+|/|g; # xx////xx -> xx/xx
- $path =~ s@(/\.)+(/|\Z(?!\n))@/@g; # xx/././xx -> xx/xx
- $path =~ s|^(\./)+||s unless $path eq "./"; # ./xx -> xx
- $path =~ s|^/(\.\./)+|/|; # /../../xx -> xx
+ $path =~ s|/{2,}|/|g; # xx////xx -> xx/xx
+ $path =~ s{(?:/\.)+(?:/|\z)}{/}g; # xx/././xx -> xx/xx
+ $path =~ s|^(?:\./)+||s unless $path eq "./"; # ./xx -> xx
+ $path =~ s|^/(?:\.\./)+|/|; # /../../xx -> xx
$path =~ s|^/\.\.$|/|; # /.. -> /
- $path =~ s|/\Z(?!\n)|| unless $path eq "/"; # xx/ -> xx
+ $path =~ s|/\z|| unless $path eq "/"; # xx/ -> xx
return "$node$path";
}
@@ -180,7 +179,7 @@ directory. (Does not strip symlinks, only '.', '..', and equivalents.)
sub no_upwards {
my $self = shift;
- return grep(!/^\.{1,2}\Z(?!\n)/s, @_);
+ return grep(!/^\.{1,2}\z/s, @_);
}
=item case_tolerant
@@ -260,7 +259,7 @@ sub splitpath {
$directory = $path;
}
else {
- $path =~ m|^ ( (?: .* / (?: \.\.?\Z(?!\n) )? )? ) ([^/]*) |xs;
+ $path =~ m|^ ( (?: .* / (?: \.\.?\z )? )? ) ([^/]*) |xs;
$directory = $1;
$file = $2;
}