WWW::CNic
a web-based API for the CentralNic domain registry system.
- Provided by: libwww-cnic-perl (Version: 0.38-2)
- Report a bug
a web-based API for the CentralNic domain registry system.
use WWW::CNic;
my @suffixlist = qw(uk.com us.com de.com eu.com);
my $query = WWW::CNic->new(command => 'search', 'domain' => 'example');
$query->set(suffixlist => \@suffixlist);
my $response = $query->execute;
if ($response->is_error) {
printf("Error: %s\n", $response->error);
} else {
foreach my $suffix(@suffixlist) {
if ($response->is_registered) {
printf("Domain %s.%s is registered to %s\n", $domain, $suffix, $response->registrant($suffix));
} else {
printf("Domain %s.%s is available for registration\n", $domain, $suffix);
}
}
}
"WWW::CNic" provides a powerful object-oriented Perl interface to the CentralNic Toolkit system.
The design of "WWW::CNic" is inspired greatly by "LWP", which is a prerequisite. Essentially, making a transaction requires building a request object, which is then executed and returns a response object. While each transaction type (search, registration, modification...) requires a different set of data to be sent by the client, all the response objects have common properties, inherited from the "WWW::CNic::Response" base class, with just a few extra methods for accessing specific information.
Installing "WWW::CNic" is as simple as:
cd /usr/src
wget http://toolkit.centralnic.com/dist/WWW-CNic-x.xx.tar.gz
tar zxvf WWW-CNic-x.xx.tar.gz
cd WWW-CNic-x.xx
perl Makefile.PL
make
make install
Consult WWW::CNic::Cookbook for detailed information on using WWW::CNic.
my $query = WWW::CNic->new( [OPTIONS] );
The constructor for this class accepts the following options:
$query->set( NAME => VALUE );
This method allows you to set any number of parameters prior to executing the query. The specifics of what parameters are required for what type of transaction is explained in WWW::CNic::Cookbook.
my $response = $query->execute();
This method makes the transaction and returns an instance of a "WWW::CNic::Response" child class.
This module is (c) 2011 CentralNic Ltd. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.