title: How do I force LWP to use Crypt::SSLeay for HTTPS requests?
body: <p>My symptom is that I cannot use a proxy with HTTPS requests with LWP.  This seems to be a common problem, and the hints on Google and even <a href="https://stackoverflow.com/questions/3723974/why-does-lwpuseragent-get-request-fail-with-https">here</a> all suggest a work-around for setting the <code>HTTPS_PROXY</code> environment variable for use by Crypt::SSLeay.</p>
  
  <p>My specific problem appears to be that LWP::Protocol::https is loading IO::Socket::SSL rather than Crypt::SSLeay. <strong>How can I force Crypt::SSLeay's use instead?</strong></p>
  
  <p>My code:</p>
  
  <pre><code>#!/usr/bin/perl
  
  use strict;
  use warnings;
  $ENV{HTTPS_PROXY} = 'http://10.0.3.1:3128';
  use LWP::UserAgent;
  my $ua = LWP::UserAgent-&gt;new();
  my $req = HTTP::Request-&gt;new('GET','https://www.meritrustcu.org/');
  my $res = $ua-&gt;request($req);
  print "$_\n" for grep { $_ =~ /SSL/ } keys %INC;
  </code></pre>
  
  <p>And it's output, showing that Crypt::SSLeay is not being used:</p>
  
  <pre><code>Net/SSLeay.pm
  IO/Socket/SSL.pm
  /usr/lib/perl5/auto/Net/SSLeay/autosplit.ix
  /usr/lib/perl5/auto/Net/SSLeay/set_proxy.al
  /usr/lib/perl5/auto/Net/SSLeay/randomize.al
  </code></pre>
  
  <p>Simply adding an explicit <code>use Crypt::SSLeay</code> to my script has proven ineffective.  It loads the module, but it continues to load IO::Socket::SSL, and use it for the HTTPS requests.</p>