1IP(3) User Contributed Perl Documentation IP(3)
2
3
4
6 Net::Whois::IP - Perl extension for looking up the whois information
7 for ip addresses
8
10 use Net::Whois::IP qw(whoisip_query);
11
12 my $ip = "192.168.1.1";
13 #Response will be a reference to a hash containing all information
14 #provided by the whois registrar
15 #The array_of_responses is a reference to an array containing references
16 #to hashes containing each level of query done. For example,
17 #many records have to be searched several times to
18 #get to the correct information, this array contains the responses
19 #from each level
20 my ($response,$array_of_responses) = whoisip_query($ip,$optional_multiple_flag,$optional_raw_flag,$option_array_of_search_options);
21 #if $optional_multiple_flag is not null, all possible responses for a give record will be returned
22 #for example, normally only the last instance of Tech phone will be give if record
23 #contains more than one, however, setting this flag to a not null will return both is an array.
24 #The other consequence, is that all records returned become references to an array and must be
25 #dereferenced to utilize
26 #if $optional_raw_flag is not null, response will be a reference to an array containing the raw
27 #response from the registrar instead of a reference to a hash.
28 #If $option_array_of_search_options is not null, the first two entries will be used to replace
29 #TechPhone and OrgTechPhone is the search method. This is fairly dangerous, and can
30 #cause the module not to work at all if set incorrectly
31
32 #Normal unwrap of $response ($optional_multiple_flag not set)
33 my $response = whoisip_query($ip);
34 foreach (sort keys(%{$response}) ) {
35 print "$_ $response->{$_} \n";
36 }
37
38 #$optional_multiple_flag set to a value my $response = whoisip_query(
39 $ip,"true"); foreach ( sort keys %$response ){
40 print "$_ is\n";
41 foreach ( @{ $response->{ $_ } } ) {
42 print " $_\n";
43 } }
44
45 #$optional_raw_flag set to a value my $response = whoisip_query(
46 $ip,"","true"); foreach (@{$response}) {
47 print $_; }
48
49 #$optonal_array_of_search_options set but not $optional_multiple_flag
50 or $optional_raw_flag my $search_options = ["NetName","OrgName"]; my
51 $response = whois_query($ip,"","",$search_options); foreach (sort
52 keys(%{$response}) ) {
53 print "$_ $response->{$_} \n"; }
54
56 Perl module to allow whois lookup of ip addresses. This module should
57 recursively query the various whois providers until it gets the more
58 detailed information including either TechPhone or OrgTechPhone by
59 default; however, this is overrideable.
60
62 Ben Schmitz -- ben@foink.com
63
64 Thanks to Orbitz for allowing the community access to this work
65
66 Please email me any suggestions, complaints, etc.
67
69 perl(1). Net::Whois
70
71
72
73perl v5.28.0 2016-01-07 IP(3)