Created
February 4, 2011 03:16
-
-
Save tkusano/810689 to your computer and use it in GitHub Desktop.
Connect IPv6 only host by libwww-perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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