Ok – so my approach to use Net::Nslookup to check domain availability didn’t work if the domain didn’t have an ‘A’ record.
In looking at CPAN I noticed that there are several functions that perform Whois lookups.
I chose to work with Net::Whois::Raw because the approach I’d need to use with it was similar to what I’d been trying to do with Net::Nslookup.
Here’s some new code for the ‘domainexist’ script:
#!/usr/bin/perl -w
use strict;
use Net::Whois::Raw;
$Net::Whois::Raw::CHECK_FAIL = 1; # function will return undef if
# the string returned from whois
# matches patterns that indicate
# that the domain isn't registered.
my $dominfo = whois( $ARGV[0] );
print "$ARGV[0] ";
if ( not defined($dominfo) ) {
print "appears to be available n";
}
else {
print "appears to be taken n";
}
An example I worked with in testing is george.me – it is registered but appears to have no DNS ‘A’ record.
Now – where was I?