From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 6CCDC1F4A5 for ; Sat, 4 Apr 2020 08:03:20 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/5] view: use defined-or operator to simplify checks Date: Sat, 4 Apr 2020 08:03:16 +0000 Message-Id: <20200404080319.3293-3-e@yhbt.net> In-Reply-To: <20200404080319.3293-1-e@yhbt.net> References: <20200404080319.3293-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We depend on Perl 5.10 features in other places. Shorten the lifetime of the `$desc' scalar while we're at it. --- lib/PublicInbox/View.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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";