From: Jim Cromie Date: Sat, 30 May 2009 17:07:57 +0000 (-0600) Subject: overload.pl shouldnt update its output unconditionally X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=813720522f;p=p5sagit%2Fp5-mst-13.2.git overload.pl shouldnt update its output unconditionally fix overload.pl to use rename_if_different, imitating reentr.pl (including commenting safer_unlink rather than scrubbing it). Leave lib/overload/number.pm unconditionally generated, since it is not a dependency for make perl With this, "make regen perl; make regen perl" will recompile at most 1x. In turn, this improves utility of regen as an added default make target. --- diff --git a/overload.pl b/overload.pl index b9c5cc6..a7dec35 100644 --- a/overload.pl +++ b/overload.pl @@ -32,9 +32,9 @@ while () { push @names, $name; } -safer_unlink ('overload.h', 'overload.c', catfile(qw(lib overload numbers.pm))); -my $c = safer_open("overload.c"); -my $h = safer_open("overload.h"); +safer_unlink (catfile(qw(lib overload numbers.pm))); +my $c = safer_open("overload.c-new"); +my $h = safer_open("overload.h-new"); mkdir("lib/overload") unless -d catdir(qw(lib overload)); my $p = safer_open(catfile(qw(lib overload numbers.pm))); @@ -150,6 +150,8 @@ EOT safer_close($h); safer_close($c); safer_close($p); +rename_if_different("overload.c-new", "overload.c"); +rename_if_different("overload.h-new","overload.h"); __DATA__ # Fallback should be the first