I second the use of DNS instead of whois.
Even with modules, whois output can be a pain to parse into something consistent for all TLDs, something made trickier by the number of registrars who limit the number of whois queries you can do per day (eg, .tv allows 20/day per IP, which makes life interesting when you have 21 .tv domains :-).
DNS doesn't have those limitations, but is equally capable of telling whether you should still be authoritative for a hostname by walking it's heirachy (eg, ask the root servers where .org is, ask the .org servers where pm.org is, ask the pm.org servers where www.pm.org is, etc.).
Something like...
#!/usr/bin/perl
use strict;
use warnings;
use Net::DNS::Resolver::Recurse;
my $host = shift or die "Usage: $0 hostname\n";
my $res = Net::DNS::Resolver::Recurse->new;
my $ans = $res->query_dorecursion($host, 'NS');
my @ns;
foreach my $ns ($ans->additional)
{
push @ns,
sprintf " %s (%s)\n",
$ns->name, # hostname
$ns->rdatastr; # ip
}
print "$host has ", scalar(@ns), " servers:-\n", @ns;
...should do the trick, if only to reduce the list of domains you don't need to whois.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.