Net::DLookup - Perform domain lookups on 2-letter and 3-letter TLDs
use Net::DLookup; # Initialize Net::DLookup object my $dlu = Net::DLookup -> new; # Replace domain definitions from a file $dlu -> LoadTLD($file, 1); # Add domain definitions from a file $dlu -> LoadTLD($file, 0); # Check domain name validity and assign it to the object @errors = $dlu -> IsValid($domain); # Return availability @response = $dlu -> DoWhois(0); # Return availability and registrar information @response = $dlu -> DoWhois(1);
Net::DLookup performs domain lookups for 2-letter and 3-letter top level domains. It also verifies the validity of domain names by checking punctuation, length, metacharacters, etc..
Information for currently recognized top level domains is included within the module. This list may be replaced or added to by calling $dlu->LoadTLD().
With the advent of new registrars for 3-letter top level domains, it's become difficult to get the whois output from a single domain lookup, unless you know what registration agency to look at. Net::DLookup solves this problem by checking Internic's database first and then performing a second query to the respective registrar for full whois output.
These functions must be used in order:
Create an object that contains the default top level domains.
my $dlu = Net::DLookup -> new;
Validate domain name ($domaintocheck) and associate it with the object. This must be the full domain name, such as yourdomain.com.
my @errors = $dlu -> IsValid($domaintocheck);
It checks for the following possible errors:
* All CCTLDs (Country Code TLDs) currently listed at IANA as well as the .com, .net, .org, .edu and .mil are checked
@errors will contain a list of all possible errors that the domain name may have, such as:
Last, the domain lookup.
@response = $domain->Net::DLookup::DoWhois();
If you're looking up a 3-letter TLD domain (.com, .net, .org, .edu and .mil), you have the choice to NOT perform the second lookup. This would be useful if you're just checking for domain availability and don't care who's already registered it. You can disable the second lookup by removing the 1. This will give you Internic's plain Jane, uninformative whois information.
@response = $domain->Net::DLookup::DoWhois(1);
Net::DLookup requires that the Sockets (included with the Perl distribution) module is installed.
Net::DLookup Version 1.01 6/10/2000
Registration agencies are finicky beasts. They may change their whois server, urls, or responses (that this module relies on) without notice. As of 6/10/2000, the agency data in the module is accurate.
Many thanks goes to Michael Chase for the new LoadTLD() and DumpTLD() routines.
D. Jasmine Merced <firstname.lastname@example.org>, CPAN ID: DJASMINE
The Perl Archive <http://www.perlarchive.com>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. If you make modifications, the author would like to know so that they can be incorporated into future releases.