diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-03-15 03:49:14 +0000 |
---|---|---|
committer | Charles Bailey <bailey@genetics.upenn.edu> | 1996-03-15 03:49:14 +0000 |
commit | c6538b72f406af2a34d587153702b663eaa3ec5e (patch) | |
tree | 597dbb62d4735d0cba137a87b98af80dd02a74a7 /lib/Cwd.pm | |
parent | 39add537f0941e7fb35c4bcb9c31da7cd9e0e0c5 (diff) | |
download | perl-c6538b72f406af2a34d587153702b663eaa3ec5e.tar.gz |
Update to use $^O
Diffstat (limited to 'lib/Cwd.pm')
-rw-r--r-- | lib/Cwd.pm | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/lib/Cwd.pm b/lib/Cwd.pm index bc206db4d4..bee2e179ae 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -1,11 +1,6 @@ package Cwd; require 5.000; require Exporter; -require Config; - -# Use osname for portability switches (doubled to cheaply avoid -w warning) -my $osname = $Config::Config{'osname'} || $Config::Config{'osname'}; - =head1 NAME @@ -177,7 +172,7 @@ sub fastcwd { my $chdir_init = 0; sub chdir_init { - if ($ENV{'PWD'} and $osname ne 'os2') { + if ($ENV{'PWD'} and $^O ne 'os2') { my($dd,$di) = stat('.'); my($pd,$pi) = stat($ENV{'PWD'}); if (!defined $dd or !defined $pd or $di != $pi or $dd != $pd) { @@ -203,7 +198,7 @@ sub chdir { $newdir =~ s|///*|/|g; chdir_init() unless $chdir_init; return 0 unless CORE::chdir $newdir; - if ($osname eq 'VMS') { return $ENV{'PWD'} = $ENV{'DEFAULT'} } + if ($^O eq 'VMS') { return $ENV{'PWD'} = $ENV{'DEFAULT'} } if ($newdir =~ m#^/#) { $ENV{'PWD'} = $newdir; @@ -225,21 +220,16 @@ sub chdir { # --- PORTING SECTION --- # VMS: $ENV{'DEFAULT'} points to default directory at all times -# 08-Dec-1994 Charles Bailey bailey@genetics.upenn.edu -# Note: Use of Cwd::getcwd() or Cwd::chdir() (but not Cwd::fastcwd()) -# causes the logical name PWD to be defined in the process -# logical name table as the default device and directory +# 06-Mar-1996 Charles Bailey bailey@genetics.upenn.edu +# Note: Use of Cwd::chdir() causes the logical name PWD to be defined +# in the process logical name table as the default device and directory # seen by Perl. This may not be the same as the default device # and directory seen by DCL after Perl exits, since the effects # the CRTL chdir() function persist only until Perl exits. -# This does not apply to other systems (where only chdir() sets PWD). sub _vms_cwd { return $ENV{'DEFAULT'} } -sub _vms_pwd { - return $ENV{'PWD'} = $ENV{'DEFAULT'} -} sub _os2_cwd { $ENV{'PWD'} = `cmd /c cd`; chop $ENV{'PWD'}; @@ -247,24 +237,27 @@ sub _os2_cwd { return $ENV{'PWD'}; } -if ($osname eq 'VMS') { +my($oldw) = $^W; +$^W = 0; # assignments trigger 'subroutine redefined' warning +if ($^O eq 'VMS') { - *cwd = \&_vms_pwd; - *getcwd = \&_vms_pwd; + *cwd = \&_vms_cwd; + *getcwd = \&_vms_cwd; *fastcwd = \&_vms_cwd; *fastgetcwd = \&_vms_cwd; } -elsif ($osname eq 'NT') { +elsif ($^O eq 'NT') { *getcwd = \&cwd; *fastgetcwd = \&cwd; } -elsif ($osname eq 'os2') { +elsif ($^O eq 'os2') { *cwd = \&_os2_cwd; *getcwd = \&_os2_cwd; *fastgetcwd = \&_os2_cwd; *fastcwd = \&_os2_cwd; } +$^W = $oldw; # package main; eval join('',<DATA>) || die $@; # quick test |