If you are trying to download a website with LWP::UserAgent in Perl through HTTPS, you might encounter errors like this:
Can't locate object method "new" via package "LWP::Protocol::https::Socket"

or

Can't connect -- 501 Protocol scheme 'https' is not supported (Crypt::SSLeay or IO::Socket::SSL not installed) at somefile.pl line something.
The solution to this problem is to install the ssl development libraries, and then install the Crypt::SSLeay Perl module. To do this in Debian or Ubuntu, open a terminal and type in the following:
sudo aptitude install libssl-dev
sudo cpan -i Crypt::SSLeay

This should fix your problem.

6 Comments on LWP::UserAgent and HTTPS

  1. colin says:

    It realy works for me, thanks

  2. Kayvan says:

    Installing libcrypt-ssleay-perl also works (rather than installing it through CPAN):

    $ sudo aptitude install libcrypt-ssleay-perl

  3. Hi Kayvan. Thanks for that tip. :-)

  4. Mads says:

    Its really works ;)

  5. Thanks a lot, got me busy for some hours. This really did the trick ;)

Leave a Reply