Subject: | [patch] One of heuristic test fails on hosts in .su (or .uk) domains |
This prevents installation using default recommended practice so it's
important.
The patch is attached.
This should also fix Tony's Finch problem in
http://www.nntp.perl.org/group/perl.libwww/2010/03/msg7384.html
Subject: | patch-su.diff |
diff --git a/t/heuristic.t b/t/heuristic.t
index f7563cb..311dba6 100644
--- a/t/heuristic.t
+++ b/t/heuristic.t
@@ -5,7 +5,7 @@ if (-f "OFFLINE") {
exit;
}
-print "1..19\n";
+print "1..20\n";
use URI::Heuristic qw(uf_urlstr uf_url);
if (shift) {
@@ -54,63 +54,71 @@ if (gethostbyname("www.perl.com") && gethostbyname("www.perl.co.uk") && !gethost
print "not " unless uf_urlstr("perl/camel.gif") =~ m,^http://www\.perl\.(org|co)\.uk/camel\.gif$,;
print "ok 6\n";
+ use Net::Domain;
$ENV{LC_ALL} = "C";
+ { no warnings; *Net::Domain::hostfqdn = sub { return 'vasya.su' } }
undef $URI::Heuristic::MY_COUNTRY;
- print "not " unless uf_urlstr("perl/camel.gif") =~ m,^http://www\.perl\.(com|org)/camel\.gif$,;
+ print "not " unless uf_urlstr("perl/camel.gif") =~ m,^http://www\.perl\.su/camel\.gif$,;
print "ok 7\n";
+ $ENV{LC_ALL} = "C";
+ { no warnings; *Net::Domain::hostfqdn = sub { return '' } }
+ undef $URI::Heuristic::MY_COUNTRY;
+ print "not " unless uf_urlstr("perl/camel.gif") =~ m,^http://www\.perl\.(com|org)/camel\.gif$,;
+ print "ok 8\n";
+
$ENV{HTTP_ACCEPT_LANGUAGE} = "en-ca";
undef $URI::Heuristic::MY_COUNTRY;
print "not " unless uf_urlstr("perl/camel.gif") eq "http://www.perl.ca/camel.gif";
- print "ok 8\n";
+ print "ok 9\n";
}
$URI::Heuristic::MY_COUNTRY = "bv";
print "not " unless uf_urlstr("perl/camel.gif") =~ m,^http://www\.perl\.(com|org)/camel\.gif$,;
- print "ok 9\n";
+ print "ok 10\n";
# Backwards compatibility; uk != United Kingdom in ISO 3166
$URI::Heuristic::MY_COUNTRY = "uk";
print "not " unless uf_urlstr("perl/camel.gif") =~ m,^http://www\.perl\.(org|co)\.uk/camel\.gif$,;
- print "ok 10\n";
+ print "ok 11\n";
$URI::Heuristic::MY_COUNTRY = "gb";
print "not " unless uf_urlstr("perl/camel.gif") =~ m,^http://www\.perl\.(org|co)\.uk/camel\.gif$,;
- print "ok 11\n";
+ print "ok 12\n";
$ENV{URL_GUESS_PATTERN} = "www.ACME.org www.ACME.com";
print "not " unless uf_urlstr("perl") eq "http://www.perl.org";
- print "ok 12\n";
+ print "ok 13\n";
} else {
# don't make the innocent worry
print "Skipping test 6-12 because DNS does not work\n";
- for (6..12) { print "ok $_\n"; }
+ for (6..13) { print "ok $_\n"; }
}
{
local $ENV{URL_GUESS_PATTERN} = "";
print "not " unless uf_urlstr("perl") eq "http://perl";
-print "ok 13\n";
+print "ok 14\n";
print "not " unless uf_urlstr("http:80") eq "http:80";
-print "ok 14\n";
+print "ok 15\n";
print "not " unless uf_urlstr("mailto:gisle\@aas.no") eq "mailto:gisle\@aas.no";
-print "ok 15\n";
+print "ok 16\n";
print "not " unless uf_urlstr("gisle\@aas.no") eq "mailto:gisle\@aas.no";
-print "ok 16\n";
+print "ok 17\n";
print "not " unless uf_urlstr("Gisle.Aas\@aas.perl.org") eq "mailto:Gisle.Aas\@aas.perl.org";
-print "ok 17\n";
+print "ok 18\n";
print "not " unless uf_url("gopher.sn.no")->scheme eq "gopher";
-print "ok 18\n";
+print "ok 19\n";
print "not " unless uf_urlstr("123.3.3.3:8080/foo") eq "http://123.3.3.3:8080/foo";
-print "ok 19\n";
+print "ok 20\n";
}
#