NAME
Net::pWhoIs - Client library for Prefix WhoIs (pWhois)
SYNOPSIS
use Net::pWhoIs;
my $obj = Net::pWhoIs->new();
# You may pass hostnames or IP addresses.
my @array = qw(
166.70.12.30
207.20.243.105
67.225.131.208
perlmonks.org
brokenhost.brokendomain.co
8.8.8.8
12.12.12.12
ftp2.freebsd.org
);
# You can pass an array.
my $output = $obj->pwhois(\@array);
# Or you can pass a scalar.
my $output = $obj->pwhois('8.8.8.8');
# Generate a formatted report.
print $obj->printReport($output);
# Or manipulate the data yourself.
for my $req (keys %{$output}) {
# req contains queried item.
print $req, "\n";
for my $key (keys %{$output->{$req}}) {
# key contains name of pwhois query result item. Output ref contains value of pwhois query result item.
printf("%s : %s\n", $key, $output->{$req}{$key});
}
# Or grab it direct.
print $output->{$req}{'city'}, "\n";
print $output->{$req}{'org-name'}, "\n";
}
DESCRIPTION
Client library for pWhois service. Includes support for bulk queries.
CONSTRUCTOR
- $obj = Net::pWhoIs->new( %options )
-
Construct a new
Net::pWhoIs
object and return it. Key/value pair arguments may be provided to set up the initial state. Thepwhoisserver whois.pwhois.org port 43
METHODS
The following methods are available:
- Net::pWhoIs->pwhois()
-
Perform queries on passed arrayref or scalar. Thus both single query and bulk queries supported. Returns a hash of hashrefs. Unresolvable hostnames are skipped.
- Net::pWhoIs->printReport()
-
An optional method which generates a formated report to stdout. Accepts returned output from Net::pWhoIs->pwhois()
Client
A full featured client is included: pwhoiscli.pl. Pass it hostnames or IP seperated by space.
OUTPUT HASHREF KEYS
The following is the list hashref keys returned by pwhois.
as-org-name
as-path
cache-date
city
country
country-code
ip
latitude
longitude
net-name
org-name
origin-as
prefix
region
route-originated-date
route-originated-ts
AUTHOR
Matt Hersant <matt_hersant@yahoo.com>