libwww-perl does not currently seem to support IPv6 communications. I'm getting the "Bad hostname" error when using an IPv6 address inside square brackets. This Debian page seems to confirm that this is due to lack of support in libwww-perl.
http://debdev.fabbione.net/cgi-bin/getinfo?libwww-perl
List: Package that does not support IPv6
Comment:
Version: 5.65-0.1
Deals with URLs: yes
Works with IPv6-only URLs: no
Tested with
env -u http_proxy HEAD http://www.ipv6.stack.nl
Supports RFC 2732 URLs: no
env -u http_proxy HEAD ’http://[2001:200:0:4819:210:f3ff:fe03:4d0]’
results in
500 Can’t connect to [2001:200:0:4819:210:f3ff:fe03:4d0]:80 (Bad hostname ’[200
1:200:0:4819:210:f3ff:fe03:4d0]’)
Full IPv6 support: no
The changelog for URI.pm indicates that version 1.13 supposedly added support for IPv6 addresses, but I guess there is more work needed within libwww-perl itself.