--- ParserBase.pm.old Fri Jan 7 11:39:51 2000 +++ ParserBase.pm Fri Jan 7 11:39:46 2000 @@ -391,16 +391,47 @@ my $eol; # EOL sequence of current line my $held_eol = ''; # EOL sequence of previous line - while (defined($_ = $in->getline)) { + my $rblock; + my $curblock = ""; + my $numread; + my $notfinished = 1; + my $curpos; + my $blocksize = 1024; + my @parsedstrings; - # Complicated chomp, to REMOVE AND REMEMBER end-of-line sequence: - ($_, $eol) = m/^(.*?)($CRLF|\n)?\Z/o; # break into line and eol + while ( $numread = $in->read($rblock, $blocksize) || $notfinished ) { + $curblock = $curblock . $rblock; + + if ($numread != $blocksize) { $notfinished = 0; } + + $#parsedstrings=-1; + + while ( ($curpos=index($curblock, "\n", 0)) != -1) + { + push(@parsedstrings, substr($curblock, 0, $curpos+1)); + $curblock = substr($curblock, $curpos+1, length($curblock)); + } + + $curpos=0; + + foreach $_ (@parsedstrings) { + $curpos=$curpos+length($_); + # Complicated chomp, to REMOVE AND REMEMBER end-of-line sequence: + ($_, $eol) = m/^(.*?)($CRLF|\n)?\Z/o; # break into line and eol - # Now, look at what we've got: - ($_ eq $delim) and return 'DELIM'; # done! - ($_ eq $close) and return 'CLOSE'; # done! + # Now, look at what we've got: + if ($_ eq $delim) { + $in->seek($in->tell - $numread+$curpos, 0); + return 'DELIM'; # done! + } + if ($_ eq $close) { + $in->seek($in->tell - $numread+$curpos, 0); + return 'CLOSE'; # done! + } + print $out $held_eol, $_; # print EOL from *last* line $held_eol = $eol; # hold EOL from *this* line + } } # Yow!