Michael Holloway > Net-DAS-0.15 > Net::DAS

Download:
Net/Das/Net-DAS-0.15.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.15   Source  

NAME ^

Net::DAS - Simple Domain Availabilty Seach client.

SYNOPSIS ^

  # new object
  my $das = Net::DAS->new();
  # you can change query timeout, set to use registrar DAS servers (where available), select only specific modules, and override the requst function (normally for testing)
  my $das = Net::DAS->new({timeout=>2,use_registrar=>1,modules=>['eu','be'],_request=>\&my_request});
  
  # lookup() always works in batch mode, so if you are only looking up a single domain you can access that domains result directly
  my $res  =$das->lookup('test.eu')->{'test.eu'};
  if ($res->{'avail'}) {
          # do something
  } else {
     print $res->{'reason'};
  }

  # or with multiple domains
  my $res  =$das->lookup('test.eu','test2.eu','test3.eu');
  print $res->{'test2.eu'}->{'reason'};

DESCRIPTION ^

Net::DAS is a client that aims to simplify using DAS with multiple registries by having small submodules (see Net::DAS::*) to iron out the differences in the servers. It also inclused a shell script Net::DAS::das to do lookups from the command line.

PUBLIC METHODS ^

new

Accepts a hash reference with available options being timeout (integer default 4), use_registrar (bool default 0), modules (array_ref default all), _request (sub - only used for overriding request method for testing)

  my $das = Net::DAS->new();
  my $das = Net::DAS->new({timeout=>2,use_registrar=>1,modules=>['eu','be'],_request=>\&my_request});

lookup

Lookup domain availability in batch mode. You can specify 1 or more domains, but always works in batch mode, so if you are only looking up a single domain you can access that domains result directly by using the domain name as a reference. When looking up multiple domains, just send an array and the return will be a hashref with the domain names as the keys

  my $res  =$das->lookup('test.eu')->{'test.eu'};
  if ($res->{'avail'}) {
          # do something
  } else {
     print $res->{'reason'};
  }

  # or with multiple domains
  my $res  =$das->lookup('test.eu','test2.eu','test3.eu');
  my $res  =$das->lookup(@domains);
  print $res->{'test2.eu'}->{'reason'};

available

A quick function to lookup availability of a single domain without details. Warning, you should check if the result == 1, as there are different return codes.

  print "available" if $das->availabile('test.eu')==1;

PRIVATE METHODS ^

_split_domain : splits a domain into an array ($dom,$tld)
_send_request : should not be called directly, its called by lookup()
_parse : should not be called directly, its called by lookup(). This sub is normally overriden by the registry module's parser
_close_ports : closes any open sockets; you should'nt need to call this.
DESTROY: ensures that any open sockets are closed cleanly before closing; you dont need to call this.

AUTHOR ^

Michael Holloway <michael@thedarkwinter.com>

LICENSE ^

Artistic License

syntax highlighting: