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.
use HTML::Entities;
use URI::Escape;
use Compress::Zlib;
+use IO::Handle;
use lib './lib';
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: $!";
$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";