Domain-Register-TK
view release on metacpan or search on metacpan
examples/basic.pl view on Meta::CPAN
# if something went wrong, tell the user about it, then exit
if (defined $api->errstr) {
die 'Error: ' . $api->errstr . ' returned while trying to ping Dot TK server';
}
print "Ping was successful.\n";
# Tell the object about your identity with the Dot TK servers.
# Note:if you want this to actually run, you need to change these values.
$api->credentials('email@tk_reseller.com', 'reseller_passsword');
my @domains_to_check = qw{ DOT.TK TESTDOMAIN-0001.TK DONALD-DUCK.TK};
foreach my $domain (@domains_to_check) {
# check if the domain is available, with prices for 3 years
my $response = $api->availability_check($domain, 3);
# if something wrong, report on that.
if (defined $api->errstr) {
die "Error: checking $domain: " . $api->errstr;
lib/Domain/Register/TK.pm view on Meta::CPAN
=head1 DEPENDENCIES
This module relies on C<XML::Simple> and C<LWP>. In addition it requires that
LWP be installed with an additional library to handle secure connections.
C<OpenSSL> or C<Crypt::SSL> are suggested as possibilities.
=head1 SUBROUTINES/METHODS
An object of this class represents a potential dialogue with Dot TK's servers,
and as such needs correct log in credentials to do anything useful.
Standard usage is to create an object, supply that object with log in
credentials, and perform an arbitrary number of transactions with the remote
server. There is a ping transaction which does not require parameters, that
should be used to test if a connection is still possible. It is possible to
change credentials after some operations (if, for example, different
currencies were being used for different end-users) without having to create
a new object.
No state is saved by the remote server between transactions, so it is not
necessary to log on or log off separately, as long as valid credentials are
supplied.
=head2 Setting Up
Simply create an object from the library, and pass the email address and
password of your reseller account to it.
use Domain::Register::TK;
my $api_object = Domain::Register::TK->new();
$api_object->credentials('login@email.com', 'mypassword');
=head2 General error handling
Every request made after setup will return values, in addition to setting
internal variables to hold the status (accessible via functions)
# for example (more details on this operation later)
$api_object->availability_check('DOT.TK');
print $api_object->status . ' - ' . $api_object->errstr;
lib/Domain/Register/TK.pm view on Meta::CPAN
};
=cut
sub ping {
my $self = shift;
my $st = $self->_get_url( { function => 'ping' } );
return $st;
}
sub credentials {
my $self = shift;
my $email = shift;
my $password = shift;
$self->{email} = $email;
$self->{password} = $password;
return;
}
=head2 Availability Check
( run in 0.228 second using v1.01-cache-2.11-cpan-4d50c553e7e )