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 016A41F5AA for ; Fri, 15 Nov 2019 09:51:02 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 07/29] learn: pass global variables into subs Date: Fri, 15 Nov 2019 09:50:38 +0000 Message-Id: <20191115095100.25633-8-e@80x24.org> In-Reply-To: <20191115095100.25633-1-e@80x24.org> References: <20191115095100.25633-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Avoid 'Variable "%s" will not stay shared' warnings when the contents of this script eval'ed into a sub. --- script/public-inbox-learn | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/public-inbox-learn b/script/public-inbox-learn index 3073294a..93aece2e 100644 --- a/script/public-inbox-learn +++ b/script/public-inbox-learn @@ -39,8 +39,8 @@ my $mime = PublicInbox::MIME->new(eval { $data }); -sub remove_or_add ($$$) { - my ($ibx, $train, $addr) = @_; +sub remove_or_add ($$$$) { + my ($ibx, $train, $mime, $addr) = @_; # We do not touch GIT_COMMITTER_* env here so we can track # who trained the message. @@ -93,12 +93,12 @@ if ($train eq 'spam') { while (my ($addr, $ibx) = each %dests) { next unless ref($ibx); # $ibx may be 0 next if $seen{"$ibx"}++; - remove_or_add($ibx, $train, $addr); + remove_or_add($ibx, $train, $mime, $addr); } my $dests = PublicInbox::MDA->inboxes_for_list_id($pi_config, $mime); for my $ibx (@$dests) { next if !$seen{"$ibx"}++; - remove_or_add($ibx, $train, $ibx->{-primary_address}); + remove_or_add($ibx, $train, $mime, $ibx->{-primary_address}); } }