HTTP GET with LWP::UserAgent
Fetch a URL with LWP::UserAgent and print the body or die on failure.
Author:
chris
// Language: Perl
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new(timeout => 10);
my $res = $ua->get('https://api.github.com/zen');
die $res->status_line unless $res->is_success;
print $res->decoded_content, "\n";