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