in reply to Re^2: Can't locate object method ""
in thread Can't locate object method ""

The interpreter is trying to find the method in IO::File, which means a line that has your file handle on it. I've seen a similar error when perl incorrectly interprets a line as using inverted invocation(e.g. my $fh = new File::IO;), but I can't seem to generate a 'functional' example at the moment.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^4: Can't locate object method ""
by chris212 (Scribe) on Dec 05, 2016 at 19:50 UTC

    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);
      There are a couple of ways that you could get a message about IO::File with no nearby file handle; for example, an accidental reference to ARGV instead of @ARGV can cause it. Would seem unlikely, though.

      It really sounds like it should be in the thread, or somehow something really hinky in threads itself.


      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.