From: Nicholas Clark Date: Tue, 31 Mar 2009 13:23:58 +0000 (+0100) Subject: Don't create an empty Errno.pm if there is an error whilst running Errno_pm.PL X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cedab142c3511603d566403c134158cf036c418d;p=p5sagit%2Fp5-mst-13.2.git Don't create an empty Errno.pm if there is an error whilst running Errno_pm.PL Implemented by initially writing to an temporary file name, and renaming as the last act. --- diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL index 49e6a66..424f0f3 100644 --- a/ext/Errno/Errno_pm.PL +++ b/ext/Errno/Errno_pm.PL @@ -13,7 +13,8 @@ my $IsSymbian = exists $ENV{SDK} && -d "$ENV{SDK}\\epoc32"; my $IsMSWin32 = $^O eq 'MSWin32' && !$IsSymbian; unlink "Errno.pm" if -f "Errno.pm"; -open OUT, ">Errno.pm" or die "Cannot open Errno.pm: $!"; +unlink "Errno.tmp" if -f "Errno.tmp"; +open OUT, ">Errno.tmp" or die "Cannot open Errno.tmp: $!"; select OUT; my $file; my @files = get_files(); @@ -39,6 +40,7 @@ else { } write_errno_pm(); unlink "errno.c" if -f "errno.c"; +rename "Errno.tmp", "Errno.pm" or die "Cannot rename Errno.tmp to Errno.pm: $!"; sub process_file { my($file) = @_;