… | |
… | |
1485 | |
1485 | |
1486 | register_read_type line => sub { |
1486 | register_read_type line => sub { |
1487 | my ($self, $cb, $eol) = @_; |
1487 | my ($self, $cb, $eol) = @_; |
1488 | |
1488 | |
1489 | if (@_ < 3) { |
1489 | if (@_ < 3) { |
1490 | # this is more than twice as fast as the generic code below |
1490 | # this is faster then the generic code below |
1491 | sub { |
1491 | sub { |
1492 | $_[0]{rbuf} =~ s/^([^\015\012]*)(\015?\012)// or return; |
1492 | (my $pos = index $_[0]{rbuf}, "\012") >= 0 |
|
|
1493 | or return; |
1493 | |
1494 | |
|
|
1495 | (my $str = substr $_[0]{rbuf}, 0, $pos + 1, "") =~ s/(\015?\012)\Z// or die; |
1494 | $cb->($_[0], "$1", "$2"); |
1496 | $cb->($_[0], $str, "$1"); |
1495 | 1 |
1497 | 1 |
1496 | } |
1498 | } |
1497 | } else { |
1499 | } else { |
1498 | $eol = quotemeta $eol unless ref $eol; |
1500 | $eol = quotemeta $eol unless ref $eol; |
1499 | $eol = qr|^(.*?)($eol)|s; |
1501 | $eol = qr|^(.*?)($eol)|s; |