sub new_sub {
my (undef, $ref) = @_;
# special case for messages like <85k5su9k59.fsf_-_@lola.goethe.zz>
- $$ref =~ /\A(\r?\n)/s or goto &new;
+ $$ref =~ /\A(\r?\n)/s or return new(undef, $ref);
my $hdr = substr($$ref, 0, $+[0], ''); # sv_chop on $$ref
bless { hdr => \$hdr, crlf => $1, bdy => $ref }, __PACKAGE__;
}
sub each_part {
my ($self, $cb, $arg, $once, $all) = @_;
my $p = mp_descend($self, $once // 0) or
- return $cb->([$self, 0, 0], $arg);
+ return $cb->([$self, 0, 1], $arg);
$cb->([$self, 0, 0], $arg) if ($all || $self->{-call_cb}); # rare
my ($self, $name, @vals) = @_;
for (@vals) {
next unless /[^\x20-\x7e]/;
- utf8::encode($_); # to octets
# 39: int((75 - length("Subject: =?UTF-8?B?".'?=') ) / 4) * 3;
- s/(.{1,39})/'=?UTF-8?B?'.encode_base64($1, '').'?='/ges;
+ s/(.{1,39})/
+ my $x = $1;
+ utf8::encode($x); # to octets
+ '=?UTF-8?B?'.encode_base64($x, '').'?='
+ /xges;
}
header_set($self, $name, @vals);
}