From: Eric Wong Date: Sat, 4 Apr 2020 08:03:16 +0000 (+0000) Subject: view: use defined-or operator to simplify checks X-Git-Tag: v1.4.0~28 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=f9b63d4cd4d5a58c37ed8464b2d335a6932cc118 view: use defined-or operator to simplify checks We depend on Perl 5.10 features in other places. Shorten the lifetime of the `$desc' scalar while we're at it. --- diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index d897aeec..9ef1f68a 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -504,9 +504,6 @@ sub attach_link ($$$$;$) { # spotting MUA problems: $ct =~ s/;.*// unless $err; $ct = ascii_html($ct); - my $desc = $part->header('Content-Description'); - $desc = $fn unless defined $desc; - $desc = '' unless defined $desc; my $sfn; if (defined $fn && $fn =~ /\A$PublicInbox::Hval::FN\z/o) { $sfn = $fn; @@ -524,6 +521,7 @@ EOF } $$rv .= "[-- Attachment #$idx: "; my $ts = "Type: $ct, Size: $size bytes"; + my $desc = $part->header('Content-Description') // $fn // ''; $desc = ascii_html($desc); $$rv .= ($desc eq '') ? "$ts --]" : "$desc --]\n[-- $ts --]"; $$rv .= "\n";