From 41ebce59dc918cf53ec606ec288ff99b8d7e5520 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Thu, 18 Jun 2009 21:27:58 +0200 Subject: [PATCH] create_index_pages: Do not die due to namespace collisions If for whatever reason the same name appears in more than one set of sections, subsections, and priorities, the code used to die. The new code will not handle this very well either (you will get repeated lines in the affected file), but at least it will not take everything else with it. --- bin/create_index_pages | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/create_index_pages b/bin/create_index_pages index 3e9fc52..66d7838 100755 --- a/bin/create_index_pages +++ b/bin/create_index_pages @@ -10,6 +10,7 @@ use Storable; use HTML::Entities; use URI::Escape; use Compress::Zlib; +use IO::Handle; use lib './lib'; @@ -75,6 +76,10 @@ sub open_file { print "opening $key\n"; mkdirp ( "$wwwdir/$key" ); + if ($fh{$key}) { + warn "filehandle for $key already open\n"; + return; + } open($fh{$key}, '>', "$wwwdir/$key/$file.slices.new") or die "Cannot open file $wwwdir/$key/$file.slices.new: $!"; @@ -95,6 +100,10 @@ sub close_file { $file ||= 'index'; print "closing $key\n"; + unless ($fh{$key}->opened()) { + warn "filehandle for $key already closed\n"; + return; + } foreach my $lang (@LANGUAGES) { print {$fh{$key}} "\n$s{begin}{$lang}\n"; -- 2.39.2