From 7a8dfc760da33a5c4437a96783ed2e4e84f1fe1c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 7 Jul 2020 20:37:38 +0000 Subject: 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. --- lib/PublicInbox/WwwAtomStream.pm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'lib') 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(). -- cgit v1.2.3-24-ge0c7