Subject: Re: [PATCH] git-send-email.perl - Fix 550 EHLO argument does not match calling host

From: Jari Aalto <[email-masked]>
Date: Sun, 14 Mar 2010 16:41:26 +0200

Junio C Hamano <[email-masked]> writes:

> Jari Aalto <[email-masked]> writes:
>
>> +sub maildomain_net
>> +{
>> +	my $maildomain;
>> +	eval "use Net::Domain";
>> +
>> +	unless ($@) {
>> +		eval "use Net::Domain";
>> +		unless ($@) {
>
> Sorry, but I don't understand the reason why you need to check the same
> thing twice.  The original you borrowed from seems to be much cleanly
> written; it essentially boils down to:
>
>     if (eval "require Net::Domain") {
>         my $domain = Net::Domain::Domainname();
>         ...
>     }
>
> without need for separate "unless ($@)", nor doubly nested construct.

Code written like that inside if-statements is pretty bad IMHO. It is
very debuggable, whereas using variables would be:

    >> +	eval "use Net::Domain";
    >> +
                Debug("use Net::Domain", $@);
    >> +	unless ($@) {

But that's my code to maintain, I'll do what is needed.
Jari