Subject: | endless loop on input not ending with eol |
getline() goes into an endless loop if the last line of a file is not
terminated by EOL characters.
The attached patch should fix this. Happy hacking!
Subject: | eof-loop.patch |
--- lib/File/GetLineMaxLength.pm.dist 2004-11-12 01:54:29.000000000 +0100
+++ lib/File/GetLineMaxLength.pm 2007-07-01 07:59:17.000000000 +0200
@@ -165,7 +165,7 @@
defined($BytesRead) || die "getline failed: $!";
# Reached EOF? Just return remnants from buffer
- if ($BytesRead == 0 && length($$Buffer) == 0) {
+ if ($BytesRead == 0) {
return substr($$Buffer, 0, length($$Buffer), '');
}