Subject: | paragraph mode is broken -- $eol should be set if $c ne "\n" |
Instead of returning paragraphs when $/ = '', IO::String returns pairs of two consecutive lines. This breaks, among other things, reading from an IO::String in Net::LDAP::LDIF.
Patch designed to emulate normal behavior for $/ and <STDIN>:
--- IO/String.pm.orig Thu Jan 8 07:41:23 2004
+++ IO/String.pm Mon Feb 23 21:13:04 2004
@@ -220,11 +220,14 @@
my $c;
while (defined($c = $self->getc)) {
if ($c eq "\n") {
- $eol++;
- } elsif ($eol > 1) {
+ next if (++$eol >= 3);
+ }
+ elsif ($eol > 1)
+ {
$self->ungetc($c);
last;
}
+ else { $eol = 0; }
$para .= $c;
}
return $para; # XXX wantarray