On Sat Jul 17 13:41:44 2010, njh@bandsman.co.uk wrote:
Show quoted text> print "Country: " .
> Net::Whois::IP::whoisip_query(212.159.106.41)->{'Country'} . "\n";
>
> Prints nl, it should print gb. Try "whois 212.159.106.41" for the
> correct results.
This is easily fixed. It gives wrong results for RIPE IPs since RIPE
changed the format of their replies, replacing OrgID with OrgId.
To fix, add an "i" to line #149, changing this:
}elsif((/OrgID:\s+(\S+)/) ||
to:
}elsif((/OrgID:\s+(\S+)/i) ||
Here is a complete patch to be used with software such as "patch":
diff -rup Net-Whois-IP-1.04/Changes fixed/Changes
--- Net-Whois-IP-1.04/Changes 2007-01-18 03:34:59.000000000 -0600
+++ fixed/Changes 2010-09-02 19:23:35.853606505 -0500
@@ -15,3 +15,10 @@ Revision history for Perl extension Net:
records
1.00 Tue Dec 6 12:55:22 2005
-no bug reports for a year... ready for release
+
+1.04 Changes made not documented here
+
+1.05 Thu Sep 2 19:22:00 2010
+ -made check for OrgID not case sensitive due to server format
changes.
+ Ray Morris <support@bettercgi.com>
+
diff -rup Net-Whois-IP-1.04/IP.pm fixed/IP.pm
--- Net-Whois-IP-1.04/IP.pm 2007-03-07 10:49:36.000000000 -0600
+++ fixed/IP.pm 2010-09-02 19:20:39.151606217 -0500
@@ -146,7 +146,7 @@ sub _do_processing {
#DO_DEBUG("Contact -- registrar = $registrar -- trying again");
last LOOP;
- }elsif((/OrgID:\s+(\S+)/) || (/source:\s+(\S+)/) &&
(!defined($hash_response->{$pattern1})) ) {
+ }elsif((/OrgID:\s+(\S+)/i) || (/source:\s+(\S+)/) &&
(!defined($hash_response->{$pattern1})) ) {
my $val = $1;
#DO_DEBUG("Orgname match: value was $val if not RIPE,APNIC,KRNIC,or
LACNIC.. will skip");
if($val =~ /^(?:RIPE|APNIC|KRNIC|LACNIC|AFRINIC)$/) {
[raymorris@raydesk1 /tmp]$ grep -Hin orgid fixed/IP.pm
fixed/IP.pm:149: }elsif((/OrgID:\s+(\S+)/i) || (/source:\s+(\S+)/) &&
(!defined($hash_response->{$pattern1})) ) {