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.1 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF 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 366E3203B3 for ; Mon, 28 Nov 2022 05:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669613566; bh=t65+gNvO/tLvXBK2+UxhgoXtr6slot9XODw5nSsnars=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GcMTEjBRtLttnTv1ORld+vqEPxt+CvpeG1ZJuVYmiii1krIErqJNeiv4gG57NPbp8 9+HwrNxfkUjkVrfUffc85RRfPkVO1radqugnM7Dg6VMOidfmISsgOoAmZ5oaM17r5f LVM3gS0/k9uVuu0a0Ktefdb2lfaNZjSHlAFr+jeA= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 64/95] fetch: eliminate File::Temp->filename var Date: Mon, 28 Nov 2022 05:32:01 +0000 Message-Id: <20221128053232.291618-65-e@80x24.org> In-Reply-To: <20221128053232.291618-1-e@80x24.org> References: <20221128053232.291618-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: File::Temp objects are overloaded to automatically call ->filename when stringified, so there's no need to store the ->filename result on the Perl stack. --- lib/PublicInbox/Fetch.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/Fetch.pm b/lib/PublicInbox/Fetch.pm index d75e427b..198e2a60 100644 --- a/lib/PublicInbox/Fetch.pm +++ b/lib/PublicInbox/Fetch.pm @@ -48,7 +48,6 @@ sub do_manifest ($$$) { my $muri = URI->new("$ibx_uri/manifest.js.gz"); my $ft = File::Temp->new(TEMPLATE => 'm-XXXX', UNLINK => 1, DIR => $dir, SUFFIX => '.tmp'); - my $fn = $ft->filename; my $mf = "$dir/manifest.js.gz"; my $m0; # current manifest.js.gz contents if (open my $fh, '<', $mf) { @@ -57,7 +56,7 @@ sub do_manifest ($$$) { }; warn($@) if $@; } - my ($bn) = ($fn =~ m!/([^/]+)\z!); + my ($bn) = ($ft->filename =~ m!/([^/]+)\z!); my $curl_cmd = $lei->{curl}->for_uri($lei, $muri, qw(-R -o), $bn); my $opt = { -C => $dir }; $opt->{$_} = $lei->{$_} for (0..2); @@ -68,7 +67,7 @@ sub do_manifest ($$$) { return; } my $m1 = eval { - PublicInbox::LeiMirror::decode_manifest($ft, $fn, $muri); + PublicInbox::LeiMirror::decode_manifest($ft, $ft, $muri); } or return [ 404, $muri ]; my $mdiff = { %$m1 };