1Whois(3) User Contributed Perl Documentation Whois(3)
2
3
4
6 Net::Whois - Get and parse "whois" domain data from InterNIC
7
9 Note that all fields except "name" and "tag" may be undef because
10 "whois" information is erratically filled in.
11
12 use Net::Whois; use Carp;
13
14 my $w = new Net::Whois::Domain $dom
15 or die "Can't connect to Whois server\n;
16
17 unless ($w->ok) { croak "No match for $dom";}
18
19 print "Domain: ", $w->domain, "\n";
20 print "Name: ", $w->name, "\n";
21 print "Tag: ", $w->tag, "\n";
22 print "Address:\n", map { " $_\n" } $w->address;
23 print "Country: ", $w->country, "\n";
24 print "Name Servers:\n", map { " $$_[0] ($$_[1])\n" }
25 @{$w->servers};
26 my ($c, $t);
27 if ($c = $w->contacts) {
28 print "Contacts:\n";
29 for $t (sort keys %$c) {
30 print " $t:\n";
31 print map { "\t$_\n" } @{$$c{$t}};
32 }
33 }
34 print "Record created:", $w->record_created ;
35 print "Record updated:", $w->record_updated ;
36
38 Net::Whois::Domain new() attempts to retrieve and parse the given
39 domain's "whois" information from the InterNIC (whois.internic.net).
40 If the server could not be contacted, is too busy, or otherwise does
41 not process the query then the constructor does not return a reference
42 and your object is undefined. If the constructor returns a reference,
43 that reference can be used to access the various attributes of the
44 domains' whois entry assuming that there was a match. The member
45 function ok returns 1 if a match 0 if no match.
46
47 Note that the Locale::Country module (part of the Locale-Codes
48 distribution) is used to recognize spelled-out country names; if that
49 module is not present, only two-letter country abbreviations will be
50 recognized.
51
52 The server consulted is "whois.internic.net". You can only get .org,
53 .edu, .net, .com domains from Internic. Other whois servers for other
54 Top-Level-Domains (TLD) return information in a different syntax and
55 are not supported at this time. Also, only queries for domains are
56 valid. Querying for a network will fail utterly since those are not
57 kept in the whois.internic.net server (a future enhancement will add a
58 network lookup function). Querying for NIC handles won't work since
59 they have a different return syntax than a domain. Domains other than
60 those listed won't work they're not in the server. A future enhancment
61 planned will send the query to the appropriate server based on its TLD.
62
64 Originally written by Chip Salzenberg (chip@pobox.com) in April of 1997
65 for Idle Communications, Inc. In September of 1998 Dana Hudes
66 (dhudes@hudes.org) found this but it was broken and he needed it so he
67 fixed it. In August, 1999 Dana and Chip agreed to become co-
68 maintainers of the module. Dana released a new version of Net::Whois
69 to CPAN and resumed active development.
70
72 This module is free software; you can redistribute it and/or modify it
73 under the same terms as Perl itself. If you make modifications, the
74 author would like to know so that they can be incorporated into future
75 releases.
76
77
78
79perl v5.30.0 2019-07-26 Whois(3)