Change 28511 by [EMAIL PROTECTED] on 2006/07/08 18:00:17
Subject: [PATCH] optimisation for File::Spec::abs2rel where both args
are relative
From: Brendan O'Dea <[EMAIL PROTECTED]>
Date: Thu, 6 Jul 2006 01:02:41 +1000
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/lib/File/Spec/Unix.pm#53 edit
Differences ...
==== //depot/perl/lib/File/Spec/Unix.pm#53 (text) ====
Index: perl/lib/File/Spec/Unix.pm
--- perl/lib/File/Spec/Unix.pm#52~26318~ 2005-12-10 07:42:39.000000000
-0800
+++ perl/lib/File/Spec/Unix.pm 2006-07-08 11:00:17.000000000 -0700
@@ -364,7 +364,13 @@
# Can't relativize across volumes
return $path unless $path_volume eq $base_volume;
- for ($path, $base) { $_ = $self->rel2abs($_) }
+ if (grep $self->file_name_is_absolute($_), $path, $base) {
+ for ($path, $base) { $_ = $self->rel2abs($_) }
+ }
+ else {
+ # save a couple of cwd()s if both paths are relative
+ for ($path, $base) { $_ = $self->catdir('/', $_) }
+ }
my $path_directories = ($self->splitpath($path, 1))[1];
my $base_directories = ($self->splitpath($base, 1))[1];
End of Patch.