Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Net::Whois sometimes fails

by nop (Hermit)
on Apr 04, 2003 at 20:58 UTC ( #248185=perlquestion: print w/replies, xml ) Need Help??
nop has asked for the wisdom of the Perl Monks concerning the following question:

Hi. The following code sometimes runs, but often fails with with the message
Registrant Name not found in returned information at C:/Perl/site/lib/Net/ line 301. .
Can someone explain why this code doesn't run consistently, and how to fix it? Thanks --
use strict; use Data::Dumper; use Net::Whois; my $url = ''; $url =~ m/^([^\/]+)\//; $1 =~ m/([^.]+\.[^.]+)$/; my $domain = $1; print STDERR "$url\nhitting whois for $domain...\n"; my $w = new Net::Whois::Domain $domain; die unless $w and $w->ok; print join("\n", $w->domain, $w->name, $w->address, $w->country); if (my $c = $w->contacts) { for my $t (sort keys %$c) { print " $t:\t"; print map { "\t$_\t" } @{$$c{$t}}; } } print "\n";

Replies are listed 'Best First'.
Re: Net::Whois sometimes fails
by Ovid (Cardinal) on Apr 04, 2003 at 21:16 UTC
      I found I had the same experience Ovid observed with Net::Whois so I ended up using Net::Whois::Raw for an application I was working on and was pleased with the results.
Re: Net::Whois sometimes fails
by Mr. Muskrat (Canon) on Apr 04, 2003 at 21:15 UTC

    Changing my $w = new Net::Whois::Domain $domain; to
    my $w = new Net::Whois::Domain $domain or die "Can't connect to Whois server\n";
    should be sufficient to explain it to you. :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://248185]
Approved by Mr. Muskrat
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2018-03-22 05:14 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (273 votes). Check out past polls.