Web lists-archives.com

Re: [PATCH] send-email: remove documented requirement for Net::SMTP::SSL




On Tue, May 28 2019, Eric Wong wrote:

> Todd Zullinger <tmz@xxxxxxxxx> wrote:
>> I wonder if it's (separately from this change) worth
>> adjusting the conditional which sets $use_net_smtp_ssl to
>> use "Net::SMTP->can('starttls')" rather than a strict
>> version check?  (It might not be if using 'can' is too
>> fragile or would only benefit the Red Hat 7 packages which
>> likely won't officially be updated to a newer git with such
>> a change.)
>>
>> 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')) {