NAME
IO::EPP::Base
SYNOPSIS
use Data::Dumper;
use IO::EPP::Base;
sub make_request {
my ( $action, $params ) = @_;
unless ( $params->{conn} ) {
# need to connect
my %sock_params = (
PeerHost => 'epp.example.com',
PeerPort => 700,
SSL_key_file => 'key.pem',
SSL_cert_file => 'cert.pem',
Timeout => 30,
);
$params->{user} = 'login';
$params->{pass} = 'xxxxx';
$params->{sock_params} = \%sock_params;
$params->{test_mode} = 1; # use emulator
# $params->{no_log} = 1; # 1 if no logging
# enter a name if you need to specify a file for the log
# $params->{log_name} = '/var/log/comm_epp_example.log';
# use our function for logging
$params->{log_fn} = sub { print "epp.example.com logger:\n$_[0]\n" };
}
return IO::EPP::Base::make_request( $action, $params );
}
my ( $answ, $msg, $conn_obj ) = make_request( 'check_domains', { domains => [ 'xyz.com', 'com.xyz', 'reged.xyz' ] } );
print Dumper $answ;
Result:
$VAR1 = {
'msg' => 'Command completed successfully.',
'xyz.com' => {
'avail' => '1'
},
'reged.xyz' => {
'reason' => 'in use',
'avail' => '0'
},
'code' => '1000',
'com.xyz' => {
'avail' => '1'
}
};
}
DESCRIPTION
Module for common EPP-functions, without extension (dnssec only).
The module can be used to work with any provider, if the requests do not use extensions and the provider does not have its own features
It has two options: using a separate function call or working as an object
FUNCTIONS
make_request
See IO:EPP for description
An example of working with functions is presented in the synopsis
Work checked on CentralNic server
INPUT: action name; parameters of query
OUTPUT: full answer with code and message; string with code and message; io::epp object
gen_pw
Authinfo Generation
INPUT: length of authInfo, default 16 symbols
OUTPUT: new authInfo
METHODS
new
Create new IO::EPP object, аutomatically connects to the provider and logins.
Example of a call
# Parameters for L<IO::Socket::SSL>
my %sock_params = (
PeerHost => 'epp.example.com',
PeerPort => 700,
SSL_key_file => $path_to_ssl_key_file,
SSL_cert_file => $path_to_ssl_cert_file,
Timeout => 30,
);
# initialization of an object, during which login is called
my $o = IO::EPP::Base->new( {
sock_params => \%sock_params,
user => $login_name,
pass => $login_password,
log_name => '/var/log/comm_epp_registry_name',
} );
# call check of domains
my ( $answ, $code, $msg ) = $o->check_domains( { domains => [ 'kalinka.realty' ] } );
undef $o; # call logout() и DESTROY() of object
Connection parameters: user
-- login; pass
-- password; tld
-- zone for providers that have a binding in it, for example, verisign; server
-- server name if the registry has different servers with different extensions, for example, pir/afilias for afilias; sock_params
-- hashref with IO::Socket::SSL parameters; test_mode
-- use a real connection or registry emulator.
Parameters for logging: no_log
-- do not write anything to the log; log_name
-- write log in this file, not in STDOUT; log_fn
-- ref on functions to write to the log.
epp_log
Writes data to the log or calls the function specified when creating the object
By default, the log is written: date and time, pid of the process, name and body of the request:
Thu Jan 1 01:00:00 1111
pid: 12345
check_domains request:
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<command>
<check>
<domain:check xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name>xyz.com</domain:name><domain:name>com.xyz</domain:name><domain:name>reged.xyz</domain:name>
</domain:check>
</check>
<clTRID>50df482a1e928a00fa0e7fce3fe68f0f</clTRID>
</command>
</epp>
Thu Feb 2 02:02:22 2222
pid: 12345
check_domains answer:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<response>
<result code="1000">
<msg>Command completed successfully.</msg>
</result>
<resData><domain:chkData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:cd><domain:name avail="1">xyz.com</domain:name></domain:cd>
<domain:cd><domain:name avail="1">com.xyz</domain:name></domain:cd>
<domain:cd><domain:name avail="0">reged.xyz</domain:name><domain:reason>in use</domain:reason></domain:cd>
</domain:chkData></resData><trID>
<clTRID>50df482a1e928a00fa0e7fce3fe68f0f</clTRID><svTRID>TEST-2979E52890117206AAA1639725F4E862</svTRID>
</trID>
</response>
</epp>
req_test
For replace req() in test mode
req
Request to registry
INPUT: out_data -- body of request; info -- name of request for log.
OUTPUT: answer from registry.
simple_request
Universal handler for simple answer
INPUT: request body; request name; check or not epp poll, default is 0
OUTPUT: answer; answer code; answer message
login
Authorization on the server. The function is automatically called from new. A separate call is only needed to change the password.
INPUT: password; addition standard parameters (<objURI>xxxxx-1.0</objURI>); extensions (<extURI>yyyyyy-1.0</extURI>); new password if need.
OUTPUT: see "simple_request".
hello
Get greeting, ping analog.
No parameters.
check_contacts
Check whether there are contacts with such IDs
INPUT: params with key: contacts
-- arrayref on contact id list.
Request:
my ( $answ, $msg ) = make_request( 'check_contacts', { contacts => [ 'H1234567', 'nfjkrek-fre8fm' ] } );
print Dumper $answ;
Answer:
$VAR1 = {
'msg' => 'Command completed successfully.',
'nfjkrek-fre8fm' => {
'avail' => '1'
},
'H1234567' => {
'avail' => '0'
},
'code' => '1000'
};
create_contact
Register a contact
OUTPUT: see "simple_request".
get_contact_info
Get information on the specified contact
update_contact
To update contact information
OUTPUT: see "simple_request".
delete_contact
Delete the specified contact
OUTPUT: see "simple_request".
check_nss
Check that the nameserver is registered
OUTPUT: see "simple_request".
create_ns
Registering a nameserver
OUTPUT: see "simple_request".
get_ns_info
Get information about the specified nameserver
update_ns
Change the data of the specified nameserver
OUTPUT: see "simple_request".
delete_ns
Remove nameserver from the registry.
OUTPUT: see "simple_request".
check_domains
Check that the domain is available for registration
create_domain
Domain registration.
OUTPUT: see "simple_request".
get_domain_info
The main information on the domain
renew_domain
Domain registration renewal for N years.
OUTPUT: see "simple_request".
update_domain
To update domain data: contact ids, nss, hosts, statuses.
OUTPUT: see "simple_request".
transfer
Domain transfers: to us, from us, reject transfers.
delete_domain
Deleting a domain.
OUTPUT: see "simple_request".
req_poll
Get and parse message from poll
ask_poll
Delete message from poll
logout
Close session, disconnect
No parameters.
AUTHORS
Vadim Likhota <vadiml@cpan.org>, some edits were made by Andrey Voyshko, Victor Efimov
COPYRIGHT
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.