diff options
author | Max Maischein <corion@corion.net> | 2010-12-11 15:21:11 +0100 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-12-11 14:09:44 -0800 |
commit | 390bf1719e311510ccb1523a89fc238b620350bf (patch) | |
tree | 2c5fb01a4380063ec434c1c548279f375fe508c8 /Porting/expand-macro.pl | |
parent | 2c949eae4460585a9e81e28e21547c21a679201a (diff) | |
download | perl-390bf1719e311510ccb1523a89fc238b620350bf.tar.gz |
Windows compatibility fixes for running expand-macro.pl:
a) Close filehandle to try.i so we can erase it
b) The build process wants to be run from bleadperl/Win32
Diffstat (limited to 'Porting/expand-macro.pl')
-rwxr-xr-x | Porting/expand-macro.pl | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Porting/expand-macro.pl b/Porting/expand-macro.pl index 772bff69df..6b33f74513 100755 --- a/Porting/expand-macro.pl +++ b/Porting/expand-macro.pl @@ -51,6 +51,13 @@ while (<>) { } die "$macro not found\n" unless defined $header; +if ($^O =~ /MSWin(32|64)/) { + # The Win32 (and Win64) build process expects to be run from + # bleadperl/Win32 + chdir "Win32" + or die "Couldn't chdir to win32: $!"; +}; + open my $out, '>', $trysource or die "Can't open $trysource: $!"; my $sentinel = "$macro expands to"; @@ -107,15 +114,17 @@ if ($opt{f} || $opt{F}) { $out_fh = \*STDOUT; } -open my $fh, '<', $tryout or die "Can't open $tryout: $!"; +{ + open my $fh, '<', $tryout or die "Can't open $tryout: $!"; -while (<$fh>) { - print $out_fh $_ if /$sentinel/o .. 1; -} + while (<$fh>) { + print $out_fh $_ if /$sentinel/o .. 1; + } +}; unless ($opt{k}) { foreach($trysource, $tryout) { - die "Can't unlink $_" unless unlink $_; + die "Can't unlink $_: $!" unless unlink $_; } } |