NAME

Net::Whois::IANA - A universal WHOIS data extractor.

SYNOPSIS

use Net::Whois::IANA;
my $ip = '132.66.16.2';
my $iana = new Net::Whois::IANA;
$iana->whois_query(-ip=>$ip);
print "Country: " . $iana->country() . "\n";;
print "Netname: " . $iana->netname() . "\n";;
print "Descr: "   . $iana->descr()   . "\n";;
print "Status: "  . $iana->status()  . "\n";;
print "Source: "  . $iana->source()  . "\n";;
print "Server: "  . $iana->server()  . "\n";;
print "Inetnum: " . $iana->inetnum() . "\n";;

ABSTRACT

This is a simple module to extract the descriptive whois
information about various IPs as they are stored in the four
regional whois registries of IANA - RIPE (Europe, Middle East,
North Africa), APNIC (Asia/Pacific), ARIN (North America and
Africa) and LACNIC (Latin American & Caribbean).

It is designed to serve statistical harvesters of various
access logs and likewise, therefore it only collects partial
and [rarely] unprecise information.

DESCRIPTION

Various Net::Whois and IP:: modules have been created.
This is just something I had to write because none of them s
uited my purpose. It is conceptually based on Net::Whois::IP
by Ben Schmitz <bschmitz@orbitz.com>, but differs from it by
a few points:

* It is object-oriented.
* It has a few immediate methods for representing some whois
fields.
* It allows the user to specify explicitly which whois servers
to query, and those servers might even not be of the four main
registries mentioned above.
* It has more robust error handling.

Net::Whois::IANA was designed to provide a mechanism to lookup
whois information and store most descriptive part of it (descr,
netname and country fields) in the object. This mechanism is
supposed to be attached to a log parser (for example an Apache
web server log) to provide various accounting and statistics
information.

The query is performed in a roundrobin system over all four
registries until a valid entry is found. The valid entry stops
the main query loop and the object with information is returned.
Unfortunately, the output formats of each one of the registries
is not completely the same and sometimes even unsimilar but
some common ground was always found and the assignment of the
information into the query object is based upon this common
ground, whatever misleading it might be.

The query to the RIPE and APNIC registries are always performed
with a '-r' flag to avoid blocking of the querying IP. Thus, the
contact info for the given entry is not obtainable with this
module. The query to the ARIN registry is performed with a '+'
flag to force the colon-separated output of the information.

EXPORT

For the convenience of the user, basic list of IANA servers
(@IANA) and their mapping to host names and ports (%IANA) are
being exported.

Also the following methods are being exported:

$iana->whois_query(-ip=>$ip,-whois=>$whois|-mywhois=>\%mywhois) :

  Perform the query on the ip specified by $ip. You can limit
the lookup to a single server (of the IANA list) by specifying
'-whois=>$whois' pair or you can provide a set of your own
servers by specifying the '-mywhois=>\%mywhois' pair. The latter
one overrides all of the IANA list for lookup.

$iana->descr()

  Returns some of the "descr:" field contents of the queried IP.

$iana->netname()

  Returns the "netname:" field contents of the queried IP.

$iana->country()

  Returns "country:" field contents of the queried IP. Useful
to combine with the Geography::Countries module.

$iana->inetnum()

  Returns the "inetnum:" field contents of the queried IP.

$iana->status()

  Returns the "status:" field contents of the queried IP.

$iana->source()

  Returns the "source:" field contents of the queried IP.

$iana->server()

  Returns the server that returned most valuable ntents of
the queried IP.

$iana->fullinfo()

  Returns the complete output of the query.

BUGS

As stated many times before, this module is not completely
homogeneous and precise because of the differences between
outputs of the IANA servers and because of some inconsistencies
within each one of them. Its primary target is to collect info
for general, shallow statistical purposes.

SEE ALSO

Net::Whois::IP, Net::Whois::RIPE, IP::Country, Geography::Countries

AUTHOR

Roman M. Parparov, <romm@empire.tau.ac.il<gt>

COPYRIGHT AND LICENSE

Copyright 2003 by Roman M. Parparov

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.