Re: [PATCH v2 1/2] send-email: squelch warning from Net::SMTP::SSL
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Jul 14, 2013, 17:03 UTC
- Message-ID
- <20130714170316.GE11097@vauxhall.crustytoothpaste.net>
- In-Reply-To
- <CALkWK0kAfZLqyCO+e+0PH0-MmjMYX1nJmit5Qb5L3Qf6nyhC9Q@mail.gmail.com>
On Sun, Jul 14, 2013 at 07:19:10PM +0530, Ramkumar Ramachandra wrote:
Show 11 quoted lines
> Torsten Bögershausen wrote: > > /usr/bin/perl -MIO::Socket::SSL -e 'print "$IO::Socket::SSL::VERSION\n";' > > 1.22 > > This is ancient! (I have 1.84). Is it not possible to do an > ssl-verify-peer in older versions (is it exported as something else)? > The older versions don't display the warning anyway, and this series > is about squelching the warning in newer versions. Does > > require IO::Socket::SSL qw(SSL_VERIFY_NONE SSL_VERIFY_PEER) or print > "warning: not using SSL_VERIFY_PEER due to outdated IO::Socket::SSL"
require doesn't take a list of symbols to import, and the import dies if it fails. You need:
require IO::Socket::SSL;
eval {
IO::Socket::SSL->import(qw(SSL_VERIFY_NONE SSL_VERIFY_PEER));
};
if ($@) {
warn "Not using SSL_VERIFY_PEER due to outdated IO::Socket::SSL\n";
# Do something different here.
}I didn't stick the require in the eval because git-send-email will fail in this case anyway if you don't have it, since Net::SMTP::SSL requires it. Let me know if you want a patch for this on top of the existing two in this series and I'll provide one.
-- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187