Apparently, my mental model of Perl internals is still incorrect
after all these years. I am but a simple *nix programmer:
everything is a bag of bytes to me.
This fixes a problem with UTF-8 headers from Xapian (via
"XHDR Subject [range]") triggering partial writes and writing an
extra newline to the outputs.
sub recheck_type_ok {
my ($part) = @_;
my $s = $part->body;
sub recheck_type_ok {
my ($part) = @_;
my $s = $part->body;
- ((bytes::length($s) < 0x10000) &&
+ ((length($s) < 0x10000) &&
($s =~ /\A([\P{XPosixPrint}\f\n\r\t]+)\z/))
}
($s =~ /\A([\P{XPosixPrint}\f\n\r\t]+)\z/))
}
my ($self, $object, $sizeref) = @_;
$object .= "\n";
my ($self, $object, $sizeref) = @_;
$object .= "\n";
- my $len = bytes::length($object);
+ my $len = length($object);
$self->_cat_file_begin;
my $written = syswrite($self->{out}, $object);
$self->_cat_file_begin;
my $written = syswrite($self->{out}, $object);
if (MSG_MORE && !$self->{write_buf_size}) {
my $n = send($self->{sock}, $data, MSG_MORE);
if (defined $n) {
if (MSG_MORE && !$self->{write_buf_size}) {
my $n = send($self->{sock}, $data, MSG_MORE);
if (defined $n) {
- my $dlen = bytes::length($data);
+ my $dlen = length($data);
return 1 if $n == $dlen; # all done!
return 1 if $n == $dlen; # all done!
- $data = bytes::substr($data, $n, $dlen - $n);
+ $data = substr($data, $n, $dlen - $n);
}
}
$self->do_write($data);
}
}
$self->do_write($data);
}
return $self->close if $r < 0;
}
return $self->close if $r < 0;
- my $len = bytes::length($self->{rbuf});
+ my $len = length($self->{rbuf});
return $self->close if ($len >= LINE_MAX);
}
return $self->close if ($len >= LINE_MAX);
}
my ($s) = @_;
my $n = getsockname($s) or return;
my ($port, $addr);
my ($s) = @_;
my $n = getsockname($s) or return;
my ($port, $addr);
- if (bytes::length($n) >= 28) {
+ if (length($n) >= 28) {
require Socket6;
($port, $addr) = Socket6::unpack_sockaddr_in6($n);
} else {
($port, $addr) = Socket::sockaddr_in($n);
}
require Socket6;
($port, $addr) = Socket6::unpack_sockaddr_in6($n);
} else {
($port, $addr) = Socket::sockaddr_in($n);
}
- if (bytes::length($addr) == 4) {
+ if (length($addr) == 4) {
$n = Socket::inet_ntoa($addr)
} else {
$n = '['.Socket6::inet_ntop(Socket6::AF_INET6(), $addr).']';
$n = Socket::inet_ntoa($addr)
} else {
$n = '['.Socket6::inet_ntop(Socket6::AF_INET6(), $addr).']';