IO::EPP::Base
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' } }; }
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
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
Authinfo Generation
INPUT: length of authInfo, default 16 symbols
OUTPUT: new authInfo
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.
user
pass
tld
server
sock_params
test_mode
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.
no_log
log_name
log_fn
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>
For replace req() in test mode
Request to registry
INPUT: out_data -- body of request; info -- name of request for log.
OUTPUT: answer from registry.
Universal handler for simple answer
INPUT: request body; request name; check or not epp poll, default is 0
OUTPUT: answer; answer code; answer message
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".
Get greeting, ping analog.
No parameters.
Check whether there are contacts with such IDs
INPUT: params with key: contacts -- arrayref on contact id list.
contacts
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' };
Register a contact
Get information on the specified contact
To update contact information
Delete the specified contact
Check that the nameserver is registered
Registering a nameserver
Get information about the specified nameserver
Change the data of the specified nameserver
Remove nameserver from the registry.
Check that the domain is available for registration
Domain registration.
The main information on the domain
Domain registration renewal for N years.
To update domain data: contact ids, nss, hosts, statuses.
Domain transfers: to us, from us, reject transfers.
Deleting a domain.
Get and parse message from poll
Delete message from poll
Close session, disconnect
Vadim Likhota <vadiml@cpan.org>, some edits were made by Andrey Voyshko, Victor Efimov
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install IO::EPP::TCI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IO::EPP::TCI
CPAN shell
perl -MCPAN -e shell install IO::EPP::TCI
For more information on module installation, please visit the detailed CPAN module installation guide.