The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Net::WhoisNG - Perl extension for whois and parsing


  use Net::WhoisNG;
  my $w=new Net::WhoisNG($domain);
     print "Domain not Found\n";
  # If lookup is successful, record is parsed and ready for use


   Single Value properties return respective scalars from their getXX methods.
   The available single value getXX method are getExpirationDate(), getLastUpdated(),
   getCreatedDate(), getStatus().

   my $exp_date=$w->getExpirationDate();

   Obtaining name servers is done with getNameServers() which returns a reference to an
   array of name servers.

   my $t_ns=$w->getNameServers();
   my @ns=@$t_ns;

   Contacts are implemeted as a person object.

   my $contact=$w->getPerson($type);

   'type' is one of (admin,tech,registrant,bill)

   The Person Object implements several methods to obtain properties of the contact

   $contact->getCredentials(); #Returns a ref to an array of contact info for $type

   getCredentials() was implemeted to return an unparsed set of info about a contact beacause some
   whois servers are so irregular in their formatting that it was a impractical to
   parse the contact info further. Where available such as with .org and .info the following methods work.

   getName(), getOrganization(), getState(), getPostalCode, getCountry(), getEmail(),
   getStreet(), getPhone(), getFax()

   you can get an XML representation of the Data if you the the optional XML::simple module by calling


Whois Next Generation. Whois lookup module alternative to Net::Whois

This module is used to lookup whois information on domains.

This version supports the com, net, org, info, biz, us and edu TLDs. Rapidly implementing other TLDs.

next in line I think these all have the same format so will only need one implementation. let me know which ones you'd want implemented sooner than others.

The module starts by examinig the extension and setting the appropriate whois server. The whois server URL is constructed as $ The method lookUp() then tries to connect and query the server. It then hands over to a parser and returns 1 if successful or 0 otherwise. U can then obtain various properties using methods listed above. Note that not all properties will be defined for every domain.


   use Net::WhoisNG();
   my $w = new Net::WhoisNG();

      my $rawxml = $w->toXML(); # Get raw XML representation (XML::Simple required)
      my $exp_date=$w->getExpirationDate();

XML Printout

   <?xml version='1.0' standalone='yes'?>
       <name> hostmaster</name>
       <city>Beverly Hills</city>
       <organization>The Perl Foundation</organization>
       <street>PO Box 18111</street>
       <detail>Golden West Telecomm</detail>
       <detail>System Administrator</detail>
       <detail>PO Box 411</detail>
       <detail>Wall, SD 57790</detail>
       <detail>+1.6052792161 (FAX) +1.6052792727</detail>

   Above XML shows the elements and how they are organized for XML output. There are two
   formats for representing whois contacts. One just dumps an unparsed record of the contact's
   deatails as shown in secend contact while the other one splits this into specific contact
   properties. Every contact will have a <parsed>1|0</parsed> element to indicate whether the
   contact information is parsed any further. The reason for the unparsed version as mentioned
   earlier, is the inconsistencies of some whois servers. The tag <status>0|1</status> shows
   whether domain is active or not.


 Net::WhoisNG::Person - Bundled along
 XML::Simple - (optional) for XML output


Net::WhoisNG::Person, whois


Pritchard Musonda, <<gt>


Copyright (C) 2004 by Pritchard Musonda

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.