From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id F17841FF161 for ; Tue, 8 Oct 2024 11:34:21 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AFD6912963; Tue, 8 Oct 2024 11:34:47 +0200 (CEST) Date: Tue, 8 Oct 2024 11:34:44 +0200 From: Christoph Heiss To: Stoiko Ivanov Message-ID: References: <20241007103214.1006844-1-c.heiss@proxmox.com> <20241007103214.1006844-2-c.heiss@proxmox.com> <20241007181128.1de3e3b2@rosa.proxmox.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20241007181128.1de3e3b2@rosa.proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [perl.org, backup.pm] Subject: Re: [pmg-devel] [PATCH pmg-api v2 1/2] utils: allow specifying plain and/or html for finalize_report() X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pmg-devel@lists.proxmox.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" Thanks for the review! On Mon, Oct 07, 2024 at 06:11:28PM GMT, Stoiko Ivanov wrote: > Thanks for the quick turn-around on this! > > on a quick glance - I think I like the approach (and that you converted > all call-sites of finalize_report directly) - however one > pitfall/suggestion inline: > > On Mon, 7 Oct 2024 12:32:11 +0200 > Christoph Heiss wrote: [..] > > --- a/src/PMG/Backup.pm > > +++ b/src/PMG/Backup.pm > > @@ -418,7 +418,7 @@ sub send_backup_notification { > > my $tt = PMG::Config::get_template_toolkit(); > > > > my $mailfrom = "Proxmox Mail Gateway "; > > - PMG::Utils::finalize_report($tt, 'backup-notification.tt', $vars, $mailfrom, $email); > > + PMG::Utils::finalize_report($tt, $vars, $mailfrom, $email, html => 'backup-notification.tt'); > I think using a hashref here would help to cause less confusion in the > future: > PMG::Utils::finalize_report($tt, $vars, $mailfrom, $email, { html => > 'backup-notification.tt'} ); (but looking through our source am not 100% > sure if we have a strong rule for this) Yeah, I think we use both variants pretty equally all around .. > > your line above is syntactically equivalent to: > PMG::Utils::finalize_report($tt, $vars, $mailfrom, $email, "html", > 'backup-notification.tt'); see: > https://perldoc.perl.org/perlop#Comma-Operator which I find confusing > (especially if I touch this code in the future) > > since finalize_report is called from quite a few places - I think having > those parameters in a hashref would be more robust, but maybe I'm > overlooking something? > No, using a hashref would work too I guess! I also don't have a particular strong opinion on that, so it's fine. As you say, it's a lot clearer in any case. I'll work through it and send a v3 soon. _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel