use Carp;
-our $VERSION = '2.03';
+our $VERSION = '2.04';
use base qw/ Exporter /;
our @EXPORT = qw(cwd getcwd fastcwd fastgetcwd);
unless(defined &cwd) {
# The pwd command is not available in some chroot(2)'ed environments
- if(grep { -x "$_/pwd" } split(':', $ENV{PATH})) {
+ if($^O eq 'MacOS' || grep { -x "$_/pwd" } split(':', $ENV{PATH})) {
*cwd = \&_backtick_pwd;
}
else {
}
}
+# set a reasonable (and very safe) default for fastgetcwd, in case it
+# isn't redefined later (20001212 rspier)
+*fastgetcwd = \&cwd;
# By Brandon S. Allbery
#
}
sub chdir {
- my $newdir = @? ? shift : ''; # allow for no arg (chdir to HOME dir)
+ my $newdir = @_ ? shift : ''; # allow for no arg (chdir to HOME dir)
$newdir =~ s|///*|/|g unless $^O eq 'MSWin32';
chdir_init() unless $chdir_init;
return 0 unless CORE::chdir $newdir;
if ($^O eq 'VMS') {
return $ENV{'PWD'} = $ENV{'DEFAULT'}
}
+ elsif ($^O eq 'MacOS') {
+ return $ENV{'PWD'} = cwd();
+ }
elsif ($^O eq 'MSWin32') {
$ENV{'PWD'} = Win32::GetFullPathName($newdir);
return 1;
*abs_path = \&fast_abs_path;
}
elsif ($^O eq 'epoc') {
- *getcwd = \&_epoc_cwd;
+ *cwd = \&_epoc_cwd;
+ *getcwd = \&_epoc_cwd;
*fastgetcwd = \&_epoc_cwd;
*fastcwd = \&_epoc_cwd;
*abs_path = \&fast_abs_path;
}
+ elsif ($^O eq 'MacOS') {
+ *getcwd = \&cwd;
+ *fastgetcwd = \&cwd;
+ *fastcwd = \&cwd;
+ *abs_path = \&fast_abs_path;
+ }
}
# package main; eval join('',<DATA>) || die $@; # quick test