From: Eric Wong Date: Tue, 7 Jul 2020 20:37:38 +0000 (+0000) Subject: wwwatomstream: avoid uninitialized warnings for $email X-Git-Tag: v1.6.0~245 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=7a8dfc760da33a5c4437a96783ed2e4e84f1fe1c;p=public-inbox.git wwwatomstream: avoid uninitialized warnings for $email As in Import, we'll fall back to Sender: if From: is missing, and use the primary_address of the inboxes to indicate the total absence of those fields. --- diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm index 3b5b133a..2f9b953b 100644 --- a/lib/PublicInbox/WwwAtomStream.pm +++ b/lib/PublicInbox/WwwAtomStream.pm @@ -136,16 +136,13 @@ sub feed_entry { $title = '(no subject)' unless defined $title && $title ne ''; $title = title_tag($title); - my $from = $hdr->header('From') or return; + my $from = $hdr->header('From') // $hdr->header('Sender') // + $ctx->{-inbox}->{-primary_address}; my ($email) = PublicInbox::Address::emails($from); - my $name = join(', ',PublicInbox::Address::names($from)); - $name = ascii_html($name); - $email = ascii_html($email); + my $name = ascii_html(join(', ', PublicInbox::Address::names($from))); + $email = ascii_html($email // $ctx->{-inbox}->{-primary_address}); - my $s = ''; - if (delete $ctx->{emit_header}) { - $s .= atom_header($ctx, $title); - } + my $s = delete($ctx->{emit_header}) ? atom_header($ctx, $title) : ''; $s .= "$name$email" . "$title$updated" . qq().