WWW::Namecheap::DNS - Namecheap API DNS methods
Namecheap API DNS methods.
See WWW::Namecheap::API for main documentation.
use WWW::Namecheap::DNS; my $dns = WWW::Namecheap::DNS->new(API => $api); $dns->sethosts(...); ...
Instantiate a new DNS object for making DNS-related API calls. Requires a WWW::Namecheap::API object.
Set the nameservers used by a domain under your management. They may be set to custom nameservers or the Namecheap default nameservers.
my $result = $dns->setnameservers( DomainName => 'example.com', Nameservers => [ 'ns1.example.com', 'ns2.example.com', ], DefaultNS => 0, );
or, for the Namecheap default:
my $result = $dns->setnameservers( DomainName => 'example.com', DefaultNS => 1, );
$result is a small hashref confirming back the domain that was modified and whether the operation was successful or not:
$result = { Domain => 'example.com', Update => 'true', };
Get a list of nameservers currently associated with a domain under your management. Returns a data structure that looks like this:
$nameservers = { Domain => 'example.com', IsUsingOurDNS => 'true', # if using the "default NS" option Nameserver => [ 'ns1.example.com', 'ns2.example.com', ], };
Get a list of DNS hosts for a domain name under management and using the Namecheap provided DNS service. Returns a data structure as follows:
$hosts = { Domain => 'example.com', IsUsingOurDNS => 'true', Host => [ { HostId => '10', Name => '@', Type => 'A', Address => '1.2.3.4', MXPref => 10, # yes, even for non-MX records }, ... ], };
See the documentation for the sethosts() method for more details of the possible values of each of these fields.
Set DNS hosts for a domain.
IMPORTANT NOTE: You must include all hosts for the domain in your sethosts command, any hosts not present in the command but previously present in the domain configuration will be deleted. You can simply modify the arrayref you get back from gethosts and pass it back in, we'll even strip out the HostIds for you! :)
my $result = $dns->sethosts( DomainName => 'example.com', Hosts => [ { Name => 'foo', # do not include domain name Type => 'A', Address => '1.2.3.4', TTL => 1800, # optional, default 1800 }, { Name => '@', # for example.com itself Type => 'MX', Address => 'mail.example.com', MXPref => 10, }, ], EmailType => 'MX', # or 'MXE' or 'FWD' );
Results in a not very useful response:
$result = { Domain => 'example.com', IsSuccess => 'true', # or false };
Further verification can be performed using a subsequent gethosts() call.
Possible values for "Type" are listed below. All relevant data (including URLs for the URL, URL301, and FRAME types) goes into the "Address" field.
* A * AAAA * CNAME * MX * MXE * TXT * URL * URL301 * FRAME
Type=MXE expects an IP address and synthesizes appropriate MX and host records.
Accessor for internal API object.
Tim Wilde, <twilde at cpan.org>
<twilde at cpan.org>
Please report any bugs or feature requests to bug-www-namecheap-api at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Namecheap-API. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-www-namecheap-api at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WWW::Namecheap::DNS
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Namecheap-API
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-Namecheap-API
CPAN Ratings
http://cpanratings.perl.org/d/WWW-Namecheap-API
Search CPAN
http://search.cpan.org/dist/WWW-Namecheap-API/
Copyright 2011 Tim Wilde.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install WWW::Namecheap::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Namecheap::API
CPAN shell
perl -MCPAN -e shell install WWW::Namecheap::API
For more information on module installation, please visit the detailed CPAN module installation guide.