« DRI/Protocol/EPP/Extensions/AusRegistry/KeyValue.pm
↑ Summary
DRI/Protocol/EPP/Extensions/SIDN/Contact.pm »
| 1 | ## Domain Registry Interface, AdamsNames Web Services Domain commands | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2009,2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 4 | ## | ||||||||||||||||||||||||||||
| 5 | ## This file is part of Net::DRI | ||||||||||||||||||||||||||||
| 6 | ## | ||||||||||||||||||||||||||||
| 7 | ## Net::DRI is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 8 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 9 | ## the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 10 | ## (at your option) any later version. | ||||||||||||||||||||||||||||
| 11 | ## | ||||||||||||||||||||||||||||
| 12 | ## See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 13 | #################################################################################################### | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | package Net::DRI::Protocol::AdamsNames::WS::Domain; | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | =pod | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =head1 NAME | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | Net::DRI::Protocol::AdamsNames::WS::Domain - AdamsNames Web Services Domain commands for Net::DRI | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | Please see the README file for details. | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | Copyright (c) 2009,2013 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||||||||||||
| 52 | All rights reserved. | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 55 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 56 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 57 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =cut | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | #################################################################################################### | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | sub register_commands | ||||||||||||||||||||||||||||
| 66 | { | ||||||||||||||||||||||||||||
| 67 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 68 | 0 | my %tmp=( | |||||||||||||||||||||||||||
| 69 | info => [\&info, \&info_parse ], | ||||||||||||||||||||||||||||
| 70 | ); | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | return { 'domain' => \%tmp }; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | sub build_msg | ||||||||||||||||||||||||||||
| 76 | { | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | my ($msg,$command,$domain)=@_; | ||||||||||||||||||||||||||
|
Subroutine
build_msg: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/adamsnames/ws',2,'Domain name needed') unless defined($domain) && $domain; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $domain and $domain
MC/DC0%0/2
defined $domain and $domain
defined $domain
$domain
Truth table0%0/3
A and B
A= defined $domainB= $domain
| |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/adamsnames/ws',10,'Invalid domain name') unless Net::DRI::Util::is_hostname($domain); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | $msg->method($command) if defined($command); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | 0 | return; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | sub info | ||||||||||||||||||||||||||||
| 86 | { | ||||||||||||||||||||||||||||
| 87 | 0 | ▶ | my ($po,$domain)=@_; | ||||||||||||||||||||||||||
|
Subroutine
info: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 88 | 0 | my $msg=$po->message(); | |||||||||||||||||||||||||||
| 89 | 0 | build_msg($msg,'domquery',$domain); | |||||||||||||||||||||||||||
| 90 | 0 | $msg->params([$domain]); | |||||||||||||||||||||||||||
| 91 | 0 | return; | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | sub info_parse | ||||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||
| 96 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
info_parse: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 97 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 98 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | my $r=$mes->result(); | |||||||||||||||||||||||||||
| 101 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/adamsnames/ws',1,'Unexpected reply for domain_info: '.$r) unless (ref($r) eq 'HASH'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | $rinfo->{domain}->{$oname}->{action}='info'; | |||||||||||||||||||||||||||
| 104 | 0 | $rinfo->{domain}->{$oname}->{exist}=$r->{'found'}; | |||||||||||||||||||||||||||
| 105 | 0 | ▶ | return unless $r->{'found'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 0 | my %r=%{$r->{domain}}; | |||||||||||||||||||||||||||
| 108 | 0 | $rinfo->{domain}->{$oname}->{crDate}=$po->{dt_parse}->parse_datetime($r{'registered'}); | |||||||||||||||||||||||||||
| 109 | 0 | my %c=(org => 'registrant', admin => 'admin', tech => 'tech', bill => 'billing'); | |||||||||||||||||||||||||||
| 110 | 0 | my $cs=$po->create_local_object('contactset'); | |||||||||||||||||||||||||||
| 111 | 0 | ▶ | while (my ($k,$v)=each(%c)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | { | ||||||||||||||||||||||||||||
| 113 | 0 | ▶ | next unless exists($r{$k}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 114 | 0 | my $c=$po->create_local_object('contact')->srid($r{$k}); | |||||||||||||||||||||||||||
| 115 | 0 | $cs->add($c,$v); | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | 0 | $rinfo->{domain}->{$oname}->{contact}=$cs; | |||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | my $h=$po->create_local_object('hosts'); | |||||||||||||||||||||||||||
| 120 | 0 | foreach my $rr (@{$r{rr}}) | |||||||||||||||||||||||||||
| 121 | { | ||||||||||||||||||||||||||||
| 122 | 0 | ▶ | next unless $rr->{rclass} eq 'ns'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | 0 | $h->add($rr->{rdata}); | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | $rinfo->{domain}->{$oname}->{ns}=$h; | |||||||||||||||||||||||||||
| 127 | 0 | $rinfo->{domain}->{$oname}->{roid}=$r{id}; | |||||||||||||||||||||||||||
| 128 | 0 | return; | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | #################################################################################################### | ||||||||||||||||||||||||||||
| 132 | 1 | 1; | |||||||||||||||||||||||||||