aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-05-08 15:12:58 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-05-08 15:12:58 +0200
commitb37fe9bed32a78bbe43ba2c152989d34f051ef85 (patch)
treea0d93d332b2024bcfac1d6ed3189db4d50872071
parentd1cedcb2e6431e0ae7d1a1c8a6ebfc1487ac8329 (diff)
downloadperlisdead-b37fe9bed32a78bbe43ba2c152989d34f051ef85.tar.gz
Make a backup of out/index.html before generation
-rwxr-xr-xgen.pl7
1 files changed, 4 insertions, 3 deletions
diff --git a/gen.pl b/gen.pl
index 2a6b6e8..b3a3b8a 100755
--- a/gen.pl
+++ b/gen.pl
@@ -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;