From: Jakub Narebski <jnareb@gmail.com>
To: Jari Aalto <jari.aalto@cante.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/3] git-send-email.perl - Fix 550 EHLO argument does not match calling host
Date: Sun, 14 Mar 2010 12:53:02 -0700 (PDT) [thread overview]
Message-ID: <m3y6huk7f4.fsf@localhost.localdomain> (raw)
In-Reply-To: <87sk83aq76.fsf_-_@jondo.cante.net>
Jari Aalto <jari.aalto@cante.net> writes:
> ---
> git-send-email.perl | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 70 insertions(+), 1 deletions(-)
>
>
>
> ================================
> This is REVISION SET 4, reworked
> ================================
Here you should describe differences from v3 (from previous version),
for easier review.
> +# This maildomain*() code is based on ideas in Perl library Test::Reporter
> +# /usr/share/perl5/Test/Reporter/Mail/Util.pm ==> sub _maildomain ()
Nice... although it might be better to use Test::Reporter::Mail::Util
as canonical module name (the package can be installed somewhere else,
depending on operating system / distribution, and if one uses
local::lib for local / per-user installation).
> +sub maildomain_net
> +{
> + my $maildomain;
> +
> + if (eval { require Net::Domain; 1 }) {
> + eval "use Net::Domain";
> + unless ($@) {
> + my $domain = Net::Domain::domainname();
> + $maildomain = $domain
> + unless $^O eq 'darwin' && $domain =~ /\.local$/;
Here should be a comment 'following what Test::Reporter does' or
something like that.
> + }
> + }
> +
> + return $maildomain;
> +}
You still have duplicated 'require' ('use' is 'require' + 'import')
and check if it succeeded. It should read:
+sub maildomain_net {
+ my $maildomain;
+
+ if (eval { require Net::Domain; 1 }) {
+ my $domain = Net::Domain::domainname();
+ $maildomain = $domain
+ unless $^O eq 'darwin' && $domain =~ /\.local$/;
+ }
+
+ return $maildomain;
+}
In the subroutine below you do not duplicate check for require.
Sidenote: alternate soultion would be to write (with one less level of
indent):
+sub maildomain_net {
+ my $maildomain;
+
+ eval { require Net::Domain; };
+ return if $@;
+
+ $maildomain = Net::Domain::domainname();
+ unless $^O eq 'darwin' && $domain =~ /\.local$/;
+
+ return $maildomain;
+}
> +
> +sub maildomain_mta
> +{
Use the same Perl convention that used elsewhere in git-send-email.perl
(this is usually used Perl style).
+sub maildomain_mta {
> + my $maildomain;
> +
> + if (eval { require Net::SMTP; 1 }) {
> + for my $host (qw(mailhost localhost)) {
> + my $smtp = Net::SMTP->new($host);
> + if (defined $smtp) {
> + my $domain = $smtp->domain;
> + $smtp->quit;
> +
> + $maildomain = $domain
> + unless $^O eq 'darwin' && $domain =~ /\.local$/;
> +
> + last if $maildomain;
> + }
> + }
> + }
> +
> + return $maildomain;
> +}
> +
> +sub maildomain
> +{
> + return maildomain_net() || maildomain_mta() || $mail_domain_default;
> +}
Nice.
--
Jakub Narebski
Poland
ShadeHawk on #git
next prev parent reply other threads:[~2010-03-14 19:53 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-10 15:57 [PATCH] Do not strip empty lines / trailing spaces from a commit message template Sebastian Schuberth
2010-03-11 8:12 ` Jeff King
2010-03-11 8:31 ` Jeff King
2010-03-11 20:46 ` Junio C Hamano
2010-03-11 22:46 ` Jeff King
2010-03-12 5:54 ` Junio C Hamano
2010-03-12 17:07 ` Sebastian Schuberth
2010-03-12 23:13 ` Junio C Hamano
2010-03-13 17:36 ` [PATCH] git-send-email.perl - Fix 550 EHLO argument does not match calling host Jari Aalto
2010-03-13 22:32 ` Junio C Hamano
2010-03-13 23:56 ` Jari Aalto
2010-03-14 6:28 ` Junio C Hamano
2010-03-14 10:19 ` Jari Aalto
2010-03-14 12:09 ` Junio C Hamano
2010-03-14 14:55 ` Jari Aalto
2010-03-14 14:59 ` Jari Aalto
2010-03-14 10:21 ` Jari Aalto
2010-03-14 11:55 ` Junio C Hamano
2010-03-14 14:41 ` Jari Aalto
2010-03-14 15:03 ` Jari Aalto
2010-03-14 13:17 ` Jakub Narebski
2010-03-14 14:52 ` Jari Aalto
2010-03-14 15:15 ` [PATCH 1/3] git-send-email.perl: improve error message in send_message() Jari Aalto
2010-03-14 15:16 ` [PATCH 2/3] git-send-email.perl: add option --smtp-debug Jari Aalto
2010-03-14 15:16 ` [PATCH 3/3] git-send-email.perl - Fix 550 EHLO argument does not match calling host Jari Aalto
2010-03-14 19:53 ` Jakub Narebski [this message]
2010-03-14 20:20 ` Jari Aalto
2010-03-14 20:33 ` [PATCH] " Jari Aalto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3y6huk7f4.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=jari.aalto@cante.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).