summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2006-12-08 11:07:06 -0800
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-12-11 13:21:28 +0000
commitcf2f24a416dd5be7d3f4153bf173ec2a57eaed43 (patch)
tree5c890bc394cfd5ee124b8e0ec263e04104cbc10b
parentc79bbeaf9959de37889eda1f77c9af1212f538ec (diff)
downloadperl-cf2f24a416dd5be7d3f4153bf173ec2a57eaed43.tar.gz
First patch from:
Subject: [PATCH] Move Win32::* functions from win32/win32.c to ext/Win32/Win32.xs Message-ID: <lc9kn2tb0p5sdd4q69rbc7067r4imar59r@4ax.com> p4raw-id: //depot/perl@29509
-rw-r--r--ext/SDBM_File/Makefile.PL2
-rw-r--r--lib/Cwd.pm7
-rw-r--r--lib/ExtUtils/MM.pm8
-rwxr-xr-xlib/File/CheckTree.t5
-rw-r--r--lib/File/Copy.pm3
-rwxr-xr-xt/op/fork.t1
-rw-r--r--win32/FindExt.pm7
-rw-r--r--win32/config_sh.PL5
-rw-r--r--win32/ext/Win32API/File/t/file.t6
9 files changed, 35 insertions, 9 deletions
diff --git a/ext/SDBM_File/Makefile.PL b/ext/SDBM_File/Makefile.PL
index ba4214c2ab..1267efc859 100644
--- a/ext/SDBM_File/Makefile.PL
+++ b/ext/SDBM_File/Makefile.PL
@@ -25,7 +25,7 @@ WriteMakefile(
);
sub MY::postamble {
- if ($^O =~ /MSWin32/ && Win32::IsWin95()) {
+ if ($^O =~ /MSWin32/ && !defined($ENV{SYSTEMROOT})) {
if ($Config{'make'} =~ /dmake/i) {
# dmake-specific
return <<'EOT';
diff --git a/lib/Cwd.pm b/lib/Cwd.pm
index 70aa8110bf..cfc0294c2b 100644
--- a/lib/Cwd.pm
+++ b/lib/Cwd.pm
@@ -660,7 +660,12 @@ sub _os2_cwd {
}
sub _win32_cwd {
- $ENV{'PWD'} = Win32::GetCwd();
+ if (defined &DynaLoader::boot_DynaLoader) {
+ $ENV{'PWD'} = Win32::GetCwd();
+ }
+ else { # miniperl
+ chomp($ENV{'PWD'} = `cd`);
+ }
$ENV{'PWD'} =~ s:\\:/:g ;
return $ENV{'PWD'};
}
diff --git a/lib/ExtUtils/MM.pm b/lib/ExtUtils/MM.pm
index e592bb829f..6fa2354a62 100644
--- a/lib/ExtUtils/MM.pm
+++ b/lib/ExtUtils/MM.pm
@@ -48,7 +48,13 @@ $Is{VMS} = $^O eq 'VMS';
$Is{OS2} = $^O eq 'os2';
$Is{MacOS} = $^O eq 'MacOS';
if( $^O eq 'MSWin32' ) {
- Win32::IsWin95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
+ if (defined &DynaLoader::boot_DynaLoader) {
+ Win32::IsWin95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
+ }
+ else {
+ # Can't use Win32::* with miniperl
+ !(defined $ENV{SYSTEMROOT}) ? $Is{Win95} = 1 : $Is{Win32} = 1;
+ }
}
$Is{UWIN} = $^O =~ /^uwin(-nt)?$/;
$Is{Cygwin} = $^O eq 'cygwin';
diff --git a/lib/File/CheckTree.t b/lib/File/CheckTree.t
index 0257f4e6f0..60f1a425ab 100755
--- a/lib/File/CheckTree.t
+++ b/lib/File/CheckTree.t
@@ -11,6 +11,11 @@ BEGIN { plan tests => 6 }
use strict;
+# Cwd::cwd does an implicit "require Win32", but
+# the ../lib directory in @INC will no longer work once
+# we chdir() out of the "t" directory.
+use Win32;
+
use File::CheckTree;
use File::Spec; # used to get absolute paths
diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm
index ea56dc6fae..d87c191c6f 100644
--- a/lib/File/Copy.pm
+++ b/lib/File/Copy.pm
@@ -258,7 +258,8 @@ unless (defined &syscopy) {
# preserve MPE file attributes.
return system('/bin/cp', '-f', $_[0], $_[1]) == 0;
};
- } elsif ($^O eq 'MSWin32') {
+ } elsif ($^O eq 'MSWin32' && defined &DynaLoader::boot_DynaLoader) {
+ # Win32::CopyFile() fill only work if we can load Win32.xs
*syscopy = sub {
return 0 unless @_ == 2;
return Win32::CopyFile(@_, 1);
diff --git a/t/op/fork.t b/t/op/fork.t
index 2d6232ef68..7318449a7c 100755
--- a/t/op/fork.t
+++ b/t/op/fork.t
@@ -245,6 +245,7 @@ EXPECT
########
$| = 1;
use Cwd;
+my $cwd = cwd(); # Make sure we load Win32.pm while "../lib" still works.
$\ = "\n";
my $dir;
if (fork) {
diff --git a/win32/FindExt.pm b/win32/FindExt.pm
index b73d777d03..690be6d882 100644
--- a/win32/FindExt.pm
+++ b/win32/FindExt.pm
@@ -14,9 +14,10 @@ my $ext;
my %static;
sub getcwd {
- $ENV{'PWD'} = Win32::GetCwd();
- $ENV{'PWD'} =~ s:\\:/:g ;
- return $ENV{'PWD'};
+ $_ = `cd`;
+ chomp;
+ s:\\:/:g ;
+ return $ENV{'PWD'} = $_;
}
sub set_static_extensions
diff --git a/win32/config_sh.PL b/win32/config_sh.PL
index 6aa2a327a0..b4af906757 100644
--- a/win32/config_sh.PL
+++ b/win32/config_sh.PL
@@ -73,7 +73,8 @@ $opt{INST_VER} =~ s|~VERSION~|$opt{VERSION}|g;
$opt{'version_patchlevel_string'} = "version $opt{PERL_VERSION} subversion $opt{PERL_SUBVERSION}";
$opt{'version_patchlevel_string'} .= " patchlevel $opt{PERL_PATCHLEVEL}" if exists $opt{PERL_PATCHLEVEL};
-$opt{'osvers'} = join '.', (Win32::GetOSVersion())[1,2];
+#$opt{'osvers'} = join '.', (Win32::GetOSVersion())[1,2];
+$opt{'osvers'} = "4.0";
if (exists $opt{cc}) {
# cl and bcc32 version detection borrowed from Test::Smoke's configsmoke.pl
@@ -99,7 +100,7 @@ $opt{libpth} = mungepath($opt{libpth}) if exists $opt{libpth};
$opt{incpath} = mungepath($opt{incpath}) if exists $opt{incpath};
# some functions are not available on Win9x
-if (defined(&Win32::IsWin95) && Win32::IsWin95()) {
+unless (defined $ENV{SYSTEMROOT}) { # SystemRoot has been introduced by WinNT
$opt{d_flock} = 'undef';
$opt{d_link} = 'undef';
}
diff --git a/win32/ext/Win32API/File/t/file.t b/win32/ext/Win32API/File/t/file.t
index 739b773ad0..f7f16c5744 100644
--- a/win32/ext/Win32API/File/t/file.t
+++ b/win32/ext/Win32API/File/t/file.t
@@ -6,6 +6,12 @@
BEGIN { $|= 1; print "1..267\n"; }
END {print "not ok 1\n" unless $loaded;}
+
+# Win32API::File does an implicit "require Win32", but
+# the ../lib directory in @INC will no longer work once
+# we chdir() into the TEMP directory.
+use Win32;
+
use Win32API::File qw(:ALL);
$loaded = 1;
print "ok 1\n";