Skip to content

Instantly share code, notes, and snippets.

@jnbek
Forked from tkusano/lwp-ipv6-test.pl
Created June 5, 2014 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnbek/9383bd4b2617d74d15e2 to your computer and use it in GitHub Desktop.
Save jnbek/9383bd4b2617d74d15e2 to your computer and use it in GitHub Desktop.
#! /usr/bin/perl
use strict;
use warnings;
use utf8;
use IO::Socket::INET6;
use LWP::UserAgent;
## Use IO::Socket::INET6 instead of IO::Socket::INET6 in Net::HTTP.
BEGIN {
$Net::HTTP::SOCKET_CLASS = 'IO::Socket::INET6';
require Net::HTTP;
}
our $URL = 'http://v6only.exsample.jp/';
my $ua = LWP::UserAgent->new;
my $res = $ua->get($URL);
if ( $res->is_success ) {
print $res->decoded_content;
}
else {
die $res->status_line;
}
## end of IPv6 test script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment