IO-EPP

 view release on metacpan or  search on metacpan

lib/IO/EPP/Taeping.pm  view on Meta::CPAN

package IO::EPP::Taeping;

=encoding utf8

=head1 NAME

IO::EPP::Taeping

=head1 SYNOPSIS

    use IO::EPP::Taeping;

    # Parameters for LWP
    my %sock_params = (
        PeerHost        => 'epp.nic.net.ru',
        PeerPort        => 7080,
        SSL_key_file    => 'key_file.pem',
        SSL_cert_file   => 'cert_file.pem',
        LocalAddr       => '1.2.3.4',
        Timeout         => 30,
    );

    # Create object, get greeting and call login()
    my $conn = IO::EPP::Taeping->new( {
        user => 'XXX-3LVL',
        pass => 'XXXXXXXX',
        sock_params => \%sock_params,
        test_mode => 0, # real connect
    } );

    # Check domain
    my ( $answ, $code, $msg ) = $conn->check_domains( { domains => [ 'my.pp.ru', 'my.org.ru' ] } );

    # Call logout() and destroy object
    undef $conn;


=head1 DESCRIPTION

Module overwrites IO::EPP::RIPN where there are differences
and work with tcinet epp using http api

Previously 3lvl.ru domains were serviced by TCI, but then were transferred to a separate registry, which has small differences

For details see:
L<https://nic.net.ru/docs/EPP-3LVL.pdf>

All documents -- L<http://pp.ru/documents.html>

IO::EPP::Taeping works with .net.ru, .org.ru  & .pp.ru only

Domain transfer in these zones works as in the .su tld

=cut

use IO::Socket::SSL;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Cookies;
use Time::HiRes qw( time );

use IO::EPP::Base;
use IO::EPP::RIPN;
use parent qw( IO::EPP::RIPN );

use strict;
use warnings;


sub make_request {
    my ( $action, $params ) = @_;

    #$params = IO::EPP::Base::recursive_utf8_unflaged( $params );

    my ( $code, $msg, $answ, $self );

    unless ( $params->{conn} ) {
        # Default:
        $params->{sock_params}{PeerHost} ||= 'epp.nic.net.ru';
        $params->{sock_params}{PeerPort} ||= 7080;

        ( $self, $code, $msg ) = __PACKAGE__->new( $params );

        unless ( $code  and  $code == 1000 ) {
            goto END_MR;
        }
    }
    else {
        $self = $params->{conn};
    }

    $self->{critical_error} = '';

    if ( $self->can( $action ) ) {
        ( $answ, $code, $msg ) = $self->$action( $params );
    }
    else {
        $msg = "undefined command <$action>, request cancelled";
        $code = 0;
    }

END_MR:

    $msg .= ', ' . $self->{critical_error} if $self->{critical_error};

    my $full_answ = "code: $code\nmsg: $msg";

    $answ = {} unless $answ && ref $answ;

    $answ->{code} = $code;
    $answ->{msg}  = $msg;

    return wantarray ? ( $answ, $full_answ, $self ) : $answ;
}




( run in 3.214 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )