… | |
… | |
1476 | if (@_ < 3) { |
1476 | if (@_ < 3) { |
1477 | # this is more than twice as fast as the generic code below |
1477 | # this is more than twice as fast as the generic code below |
1478 | sub { |
1478 | sub { |
1479 | $_[0]{rbuf} =~ s/^([^\015\012]*)(\015?\012)// or return; |
1479 | $_[0]{rbuf} =~ s/^([^\015\012]*)(\015?\012)// or return; |
1480 | |
1480 | |
1481 | $cb->($_[0], $1, $2); |
1481 | $cb->($_[0], "$1", "$2"); |
1482 | 1 |
1482 | 1 |
1483 | } |
1483 | } |
1484 | } else { |
1484 | } else { |
1485 | $eol = quotemeta $eol unless ref $eol; |
1485 | $eol = quotemeta $eol unless ref $eol; |
1486 | $eol = qr|^(.*?)($eol)|s; |
1486 | $eol = qr|^(.*?)($eol)|s; |
1487 | |
1487 | |
1488 | sub { |
1488 | sub { |
1489 | $_[0]{rbuf} =~ s/$eol// or return; |
1489 | $_[0]{rbuf} =~ s/$eol// or return; |
1490 | |
1490 | |
1491 | $cb->($_[0], $1, $2); |
1491 | $cb->($_[0], "$1", "$2"); |
1492 | 1 |
1492 | 1 |
1493 | } |
1493 | } |
1494 | } |
1494 | } |
1495 | }; |
1495 | }; |
1496 | |
1496 | |