From: Junio C Hamano Date: Sun, 07 Jul 2013 10:01:44 GMT Subject: Re: [PATCH v2 2/2] send-email: introduce sendemail.smtpsslcertpath Message-ID: <7vfvvq6647.fsf@alter.siamese.dyndns.org> In-Reply-To: <20130707055438.GA1730@sigill.intra.peff.net> Jeff King writes: > On Fri, Jul 05, 2013 at 08:29:48PM +0000, brian m. carlson wrote: > >> On Fri, Jul 05, 2013 at 10:20:11AM -0700, Junio C Hamano wrote: >> > +# Helper to come up with SSL/TLS certification validation params >> > +# and warn when doing no verification >> > +sub ssl_verify_params { >> > + use IO::Socket::SSL qw(SSL_VERIFY_PEER SSL_VERIFY_NONE); >> >> You might as well put this at the top of the file, because all use >> statements happen at compile time anyway, regardless of their location. >> If you want to lazy-load this, you need to do: >> >> require IO::Socket::SSL; >> IO::Socket::SSL->import(qw(SSL_VERIFY_PEER SSL_VERIFY_NONE)); >> >> which is equivalent to "use" except that it happens at runtime. > > I think we _must_ lazy load this, or else we are breaking git-send-email > users on platforms that do not have IO::Socket::SSL (and do not plan on > using SSL themselves). > > The same goes for the "use" in patch 1/2. A very good point. Thanks. Also it appears that people seem to be seeing different behaviours depending on the versions of IO::Socket::SSL they have; we may need to conditionalize what our code does depending on $PACKAGE::Version after we do that lazy loading.