From: Perl 5 Porters Date: Fri, 15 Mar 1996 03:49:14 +0000 (+0000) Subject: Update to use $^O X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c6538b72f406af2a34d587153702b663eaa3ec5e;hp=39add537f0941e7fb35c4bcb9c31da7cd9e0e0c5;p=p5sagit%2Fp5-mst-13.2.git Update to use $^O --- diff --git a/lib/AutoSplit.pm b/lib/AutoSplit.pm index fd537bb..f9e3ad6 100644 --- a/lib/AutoSplit.pm +++ b/lib/AutoSplit.pm @@ -37,7 +37,7 @@ $CheckModTime = 1; $IndexFile = "autosplit.ix"; # file also serves as timestamp $maxflen = 255; $maxflen = 14 if $Config{'d_flexfnam'} ne 'define'; -$vms = ($Config{'osname'} eq 'VMS'); +$Is_VMS = ($^O eq 'VMS'); sub autosplit{ @@ -62,7 +62,7 @@ sub autosplit_lib_modules{ s#::#/#g; # incase specified as ABC::XYZ s|\\|/|g; # bug in ksh OS/2 s#^lib/##; # incase specified as lib/*.pm - if ($vms && /[:>\]]/) { # may need to convert VMS-style filespecs + if ($Is_VMS && /[:>\]]/) { # may need to convert VMS-style filespecs my ($dir,$name) = (/(.*])(.*)/); $dir =~ s/.*lib[\.\]]//; $dir =~ s#[\.\]]#/#g; @@ -82,9 +82,7 @@ sub autosplit_file{ # where to write output files $autodir = "lib/auto" unless $autodir; - if ($Config{'osname'} eq 'VMS') { - ($autodir = VMS::Filespec::unixpath($autodir)) =~ s#/$##; - } + ($autodir = VMS::Filespec::unixpath($autodir)) =~ s#/$## if $Is_VMS; unless (-d $autodir){ local($", @p)="/"; foreach(split(/\//,$autodir)){ @@ -130,7 +128,7 @@ sub autosplit_file{ die "Package $package does not match filename $filename" unless ($filename =~ m/$modpname.pm$/ or - $vms && $filename =~ m/$modpname.pm/i); + $Is_VMS && $filename =~ m/$modpname.pm/i); if ($check_mod_time){ my($al_ts_time) = (stat("$al_idx_file"))[9] || 1; diff --git a/lib/Cwd.pm b/lib/Cwd.pm index bc206db..bee2e17 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('',) || die $@; # quick test diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm index 23a93e5..3560f2d 100755 --- a/lib/diagnostics.pm +++ b/lib/diagnostics.pm @@ -3,7 +3,7 @@ eval 'exec perl -S $0 ${1+"$@"}' if 0; use Config; -if ($Config{'osname'} eq 'VMS') { +if ($^O eq 'VMS') { $diagnostics::PODFILE = VMS::Filespec::unixify($Config{'privlib'}) . '/pod/perldiag.pod'; }