8.10. LWP::Simple

Example 8-8. examples/network/lwp_simple.pl

#!/usr/bin/perl
use strict;
use warnings;

my $url = 'http://localhost/';
if (defined $ARGV[0]) {
    $url = $ARGV[0];
}

use LWP::Simple qw(get);

my $page = get($url);
if (defined $page) {
    print $page;
} else {
    print "Could not fetch $url\n";
}

If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed