in reply to File read stopping prematurely
G'day Ineffectual,
I'm not actually familiar with IO::Uncompress::AnyUncompress so the following are just some troubleshooting hints as well as some guesswork based on the documentation (in particular, the OO Interface: Constructor Options section, referenced below).
The discrepancy between the line counts of 5,042,137 and 13,263 is obviously quite substantial. Perhaps some files are being read as a single string due to "Transparent => 1": see "... treat the whole file/buffer as a single data stream." in the docs.
Try moving the line counting code so it's counting individual files; maybe also check the size of the data being read. Something like this rough outline:
foreach ... ... my $linecount = 0; my $datasize = 0; while (... $datasize += length; ... ++$linecount; } close ... print $linecount, $datasize; }
I see you have "AutoClose => 1"; however, the docs say "This option is only valid when the $input parameter is a filehandle.". Your $input is a filename, not a filehandle, so perhaps turn that off or remove it altogether (the default is 0).
Here's a few other things which probably (but not certainly) are unrelated to your current problem.
-- Ken
|
|---|