Skip to content

Instantly share code, notes, and snippets.

@tkusano
Created February 4, 2011 03:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tkusano/810689 to your computer and use it in GitHub Desktop.
Save tkusano/810689 to your computer and use it in GitHub Desktop.
Connect IPv6 only host by libwww-perl
#! /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