diff options
author | John Ankarström <john@ankarstrom.se> | 2021-05-08 15:12:58 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-05-08 15:12:58 +0200 |
commit | b37fe9bed32a78bbe43ba2c152989d34f051ef85 (patch) | |
tree | a0d93d332b2024bcfac1d6ed3189db4d50872071 | |
parent | d1cedcb2e6431e0ae7d1a1c8a6ebfc1487ac8329 (diff) | |
download | perlisdead-b37fe9bed32a78bbe43ba2c152989d34f051ef85.tar.gz |
Make a backup of out/index.html before generation
-rwxr-xr-x | gen.pl | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -36,6 +36,7 @@ chdir $Bin; mkdir 'out' if ! -d 'out'; open my $src, '<', 'src/index.html' or die "Could not open < src/index.html: $!"; open my $out, '>', 'out/index.html.tmp' or die "Could not open > out/index.html.tmp: $!"; +copy 'src/index.html', 'src/index.html.bkp'; select $out; for (<$src>) { when (/^\.inc (.*)/) { @@ -75,7 +76,7 @@ for (<$src>) { close $cache; close $run; if ($i) { - move "cache/$1.tmp" => "cache/$1"; + move "cache/$1.tmp", "cache/$1"; next; } } @@ -98,7 +99,7 @@ close $src; # Rename temporary file -move 'out/index.html.tmp' => 'out/index.html'; +move 'out/index.html.tmp', 'out/index.html'; # Copy modified static files @@ -110,7 +111,7 @@ for (keys %src) { no warnings 'uninitialized'; if ($src{$_} > $out{$_}) { print STDERR "COPY: src/$_ => out/$_\n" if $opt{d}; - copy "src/$_" => "out/$_"; + copy "src/$_", "out/$_"; } } closedir $out; |