Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote: > On Tue, May 28 2019, Eric Wong wrote: > > Todd Zullinger <tmz@xxxxxxxxx> wrote: > >> Something like: > >> > >> diff --git i/git-send-email.perl w/git-send-email.perl > >> index 24859a7bc3..84ac03994d 100755 > >> --- i/git-send-email.perl > >> +++ w/git-send-email.perl > >> @@ -1465,7 +1465,7 @@ sub send_message { > >> } > >> > >> require Net::SMTP; > >> - my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("2.34"); > >> + my $use_net_smtp_ssl = Net::SMTP->can('starttls') ? 0 : 1; > >> $smtp_domain ||= maildomain(); > >> > >> if ($smtp_encryption eq 'ssl') { > > > > Looks much better to me. > > Same, but to bikeshed a bit, at this point we can just do: > > diff --git a/git-send-email.perl b/git-send-email.perl > index 24859a7bc3..4ad2091a49 100755 > --- a/git-send-email.perl > +++ b/git-send-email.perl > @@ -1468 +1467,0 @@ sub send_message { > - my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("2.34"); > @@ -1485 +1484 @@ sub send_message { > - if ($use_net_smtp_ssl) { > + if (Net::SMTP->can('starttls')) { > @@ -1507 +1506 @@ sub send_message { > - if ($use_net_smtp_ssl) { > + if (Net::SMTP->can('starttls')) { Higher probability of a typo slipping through the cracks, though :) (I was just bit by a similar case with hashes that would've been caught by "use fields")