LWP :: Protocol :: https not installed (how to install?)

Can someone help me? I created a Perl script to run the https task. When I run it, I get the error LWP :: Protocol :: https is not installed.

I can’t understand, or find a tutorial or command on exactly how to install LWP :: Protocol :: http. Does anyone know how to install it? Installing LWP was pretty simple.

I installed LWP and installed Crypt-SSLeay, however I still get the error. Here is my code:

use LWP::UserAgent; my $ua = LWP::UserAgent->new; # set custom HTTP request header fields my $req = HTTP::Request->new(PUT => "https://thesite.com"); $req->header('Authorization' => 'myauth'); $req->header('Accept' => 'JSON:Application/JSON'); $req->header('Content-Type' => 'JSON:Application/JSON'); $req->header('Host' => 'api.thesite.com'); $req->content('Text' => 'thetext'); my $resp = $ua->request($req); if ($resp->is_success) { my $message = $resp->decoded_content; print "Received reply: $message\n"; } else { print "HTTP POST error code: ", $resp->code, "\n"; print "HTTP POST error message: ", $resp->message, "\n"; } 

Thanks for the help!

+7
perl lwp
source share
2 answers

Running sudo cpan install LWP::Protocol::https fixed this for me.

+3
source

sudo yum install perl-LWP-Protocol-https fixed problem for me.

0
source

All Articles