There are only two file handles used in the code. One in the input thread, and one in the output thread (the one that "terminated abnormally"). Both are declared with "my" in the thread's subroutine. Based on the arguments used when the crash happened, the only lines that use the file handle in the output thread are:
my $fh;
open($fh,'>',$output) or fail("Failed to read $output",$!);
binmode($fh);
my $csv;
$csv = Text::CSV_XS->new ({ binary => 1, eol => $outputeol, sep_char =
+> $outputdelim, quote_char => $outputenc, escape_char => $outputesc }
+)
or fail("Failed to create output CSV object",Text::CSV->error_diag
+());
while(1) {
my $th = $q->dequeue;
last unless(defined $th);
my $chunk = $th->join();
foreach my $outputs(@$chunk) {
$csv->print($fh,$outputs);
}
}
close($fh);
|