Re: [PATCH] git-send-email.perl - Fix 550 EHLO argument does not match calling host
- From
Jari Aalto <jari.aalto@cante.net>
- Date
- Mar 14, 2010, 14:41 UTC
- Message-ID
- <87pr37c6eh.fsf@jondo.cante.net>
- In-Reply-To
- <7vljdvp16n.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 21 quoted lines
> Jari Aalto <jari.aalto@cante.net> 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