develooper Front page | perl.perl5.porters | Postings from April 2016

[PATCH 2/2] Fix: perlmain.c is always rebuilt

Thread Next
From:
Ivan Pozdeev via perl5-porters
Date:
April 20, 2016 02:08
Subject:
[PATCH 2/2] Fix: perlmain.c is always rebuilt
Message ID:
5716E48D.4080703@mail.mipt.ru
---
ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm 
b/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm
index 61c66df..66ec5f4 100644
--- a/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm
+++ b/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm
@@ -22,6 +22,7 @@ sub writemain{
my ($fh, $real);

if (ref $_[0] eq 'SCALAR') {
+ require File::Compare;
$real = ${+shift};
$temp = $real;
$temp =~ s/(?:.c)?\z/.new/;
@@ -208,7 +209,13 @@ EOT

if ($real) {
close $fh or die "Can't close '$temp': $!";
- rename $temp, $real or die "Can't rename '$temp' to '$real': $!";
+ my $c = (-f $real) ? File::Compare::compare($temp, $real) : 1;
+ $c == -1 and die "Can't compare '$temp' and '$real': $!";
+ if ($c) {
+ rename $temp, $real or die "Can't rename '$temp' to '$real': $!"
+ } else {
+ unlink $temp or die "Can't unlink '$temp': $!";
+ }
}
}

-- 
1.9.5.msysgit.1


-- 
Regards,
Ivan


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About