summaryrefslogtreecommitdiff
path: root/lib/File
diff options
context:
space:
mode:
authorKen Williams <ken@mathforum.org>2003-08-18 12:07:43 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2003-08-19 13:08:45 +0000
commitf9fbf424fb61f97e6792e9a8ed040a85ffe5d3b2 (patch)
tree648722b685fd5bbbf0c7331702935986ff20553a /lib/File
parent591b4a2d55c04d7fd1536fbe03d54504cbf915b9 (diff)
downloadperl-f9fbf424fb61f97e6792e9a8ed040a85ffe5d3b2.tar.gz
maintperl - File::Spec cwd() stuff
Message-Id: <645E5A7D-D1C8-11D7-84BF-003065F6D85A@mathforum.org> p4raw-id: //depot/perl@20770
Diffstat (limited to 'lib/File')
-rw-r--r--lib/File/Spec/OS2.pm11
-rw-r--r--lib/File/Spec/Unix.pm3
-rw-r--r--lib/File/Spec/t/Spec.t1
3 files changed, 9 insertions, 6 deletions
diff --git a/lib/File/Spec/OS2.pm b/lib/File/Spec/OS2.pm
index f323358fd6..14188900f0 100644
--- a/lib/File/Spec/OS2.pm
+++ b/lib/File/Spec/OS2.pm
@@ -29,6 +29,11 @@ sub path {
return @path;
}
+sub cwd {
+ require Cwd;
+ return Cwd::sys_cwd();
+}
+
=pod
=item tmpdir
@@ -200,8 +205,7 @@ sub abs2rel {
# Figure out the effective $base and clean it up.
if ( !defined( $base ) || $base eq '' ) {
- require Cwd;
- $base = Cwd::sys_cwd() ;
+ $base = $self->cwd();
} elsif ( ! $self->file_name_is_absolute( $base ) ) {
$base = $self->rel2abs( $base ) ;
} else {
@@ -259,8 +263,7 @@ sub rel2abs {
if ( ! $self->file_name_is_absolute( $path ) ) {
if ( !defined( $base ) || $base eq '' ) {
- require Cwd;
- $base = Cwd::sys_cwd() ;
+ $base = $self->cwd();
}
elsif ( ! $self->file_name_is_absolute( $base ) ) {
$base = $self->rel2abs( $base ) ;
diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm
index c76152b0bd..703d23a7ee 100644
--- a/lib/File/Spec/Unix.pm
+++ b/lib/File/Spec/Unix.pm
@@ -446,8 +446,7 @@ sub rel2abs {
if ( ! $self->file_name_is_absolute( $path ) ) {
# Figure out the effective $base and clean it up.
if ( !defined( $base ) || $base eq '' ) {
- require Cwd;
- $base = Cwd::cwd() ;
+ $base = $self->cwd();
}
elsif ( ! $self->file_name_is_absolute( $base ) ) {
$base = $self->rel2abs( $base ) ;
diff --git a/lib/File/Spec/t/Spec.t b/lib/File/Spec/t/Spec.t
index 847d9010ca..f3e49f03c3 100644
--- a/lib/File/Spec/t/Spec.t
+++ b/lib/File/Spec/t/Spec.t
@@ -214,6 +214,7 @@ if ($^O eq 'MacOS') {
[ "Win32->canonpath('/a/b/c/../../d')", '\\a\\d' ],
[ "Win32->canonpath('/a/b/c/.../d')", '\\a\\d' ],
[ "Win32->canonpath('\\../temp\\')", '\\temp' ],
+[ "Win32->can('cwd')", qr/CODE/ ],
# FakeWin32 subclass (see below) just sets CWD to C:\one\two