summaryrefslogtreecommitdiff
path: root/lib/Cwd.pm
diff options
context:
space:
mode:
authorTels <nospam-abuse@bloodgate.com>2003-07-08 00:41:42 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2003-08-17 07:52:47 +0000
commite2ba406b0afaa3ee7f9fb58da681d29a6772e2ed (patch)
tree6fa75acdd325140bf0a649b5daed54dc0d7f9409 /lib/Cwd.pm
parent72f15715c6c3759affc3e9b41e7833c9c3ccb901 (diff)
downloadperl-e2ba406b0afaa3ee7f9fb58da681d29a6772e2ed.tar.gz
The lib/Cwd.pm diet part of
Subject: [PATCH] File::Spec on diet Message-Id: <200307072235.03364@bloodgate.com> p4raw-id: //depot/perl@20745
Diffstat (limited to 'lib/Cwd.pm')
-rw-r--r--lib/Cwd.pm31
1 files changed, 21 insertions, 10 deletions
diff --git a/lib/Cwd.pm b/lib/Cwd.pm
index 305cc60018..db13aab433 100644
--- a/lib/Cwd.pm
+++ b/lib/Cwd.pm
@@ -138,8 +138,6 @@ L<File::chdir>
use strict;
-use Carp;
-
our $VERSION = '2.08';
use base qw/ Exporter /;
@@ -360,7 +358,8 @@ sub _perl_abs_path
unless (@cst = stat( $start ))
{
- carp "stat($start): $!";
+ require Carp;
+ Carp::carp ("stat($start): $!");
return '';
}
$cwd = '';
@@ -372,12 +371,14 @@ sub _perl_abs_path
local *PARENT;
unless (opendir(PARENT, $dotdots))
{
- carp "opendir($dotdots): $!";
+ require Carp;
+ Carp::carp ("opendir($dotdots): $!");
return '';
}
unless (@cst = stat($dotdots))
{
- carp "stat($dotdots): $!";
+ require Carp;
+ Carp::carp ("stat($dotdots): $!");
closedir(PARENT);
return '';
}
@@ -391,7 +392,8 @@ sub _perl_abs_path
{
unless (defined ($dir = readdir(PARENT)))
{
- carp "readdir($dotdots): $!";
+ require Carp;
+ Carp::carp ("readdir($dotdots): $!");
closedir(PARENT);
return '';
}
@@ -423,10 +425,15 @@ sub fast_abs_path {
($path) = $path =~ /(.*)/;
($cwd) = $cwd =~ /(.*)/;
- CORE::chdir($path) || croak "Cannot chdir to $path: $!";
+ if (!CORE::chdir($path)) {
+ require Carp;
+ Carp::croak ("Cannot chdir to $path: $!");
+ }
my $realpath = getcwd();
- -d $cwd && CORE::chdir($cwd) ||
- croak "Cannot chdir back to $cwd: $!";
+ if (! ((-d $cwd) && (CORE::chdir($cwd)))) {
+ require Carp;
+ Carp::croak ("Cannot chdir back to $cwd: $!");
+ }
$realpath;
}
@@ -452,7 +459,11 @@ sub _vms_cwd {
sub _vms_abs_path {
return $ENV{'DEFAULT'} unless @_;
my $path = VMS::Filespec::pathify($_[0]);
- croak("Invalid path name $_[0]") unless defined $path;
+ if (! defined $path)
+ {
+ require Carp;
+ Carp::croak("Invalid path name $_[0]")
+ }
return VMS::Filespec::rmsexpand($path);
}