| 1 | ## Domain Registry Interface, .LU Contact EPP extension commands | ||||||||||||||||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2007,2008,2013,2016 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::EPP::Extensions::LU::Contact; | ||||||||||||||||||||||||||||||||||||||||||
| 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::Util; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | =pod | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | Net::DRI::Protocol::EPP::Extensions::LU::Contact - .LU EPP Contact extension commands for Net::DRI | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | Please see the README file for details. | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | Copyright (c) 2007,2008,2013,2016 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||||||||||||||||||||||||||
| 51 | All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||
| 54 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||
| 55 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||||||||||||||||
| 56 | (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | #################################################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | sub register_commands | ||||||||||||||||||||||||||||||||||||||||||
| 65 | { | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my %tmp=( | |||||||||||||||||||||||||||||||||||||||||
| 68 | info => [ undef, \&info_parse ], | ||||||||||||||||||||||||||||||||||||||||||
| 69 | create => [ \&create, undef ], | ||||||||||||||||||||||||||||||||||||||||||
| 70 | update => [ \&update, undef ], | ||||||||||||||||||||||||||||||||||||||||||
| 71 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | return { 'contact' => \%tmp }; | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | #################################################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | sub info_parse | ||||||||||||||||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
info_parse: not called CC=13 SCAR=52.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $infdata=$mes->get_extension('dnslu','ext'); | |||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | return unless $infdata; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $ns=$mes->ns('dnslu'); | |||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $infdata=$infdata->getChildrenByTagNameNS($ns,'resData'); | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | return unless $infdata->size(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $infdata=$infdata->shift()->getChildrenByTagNameNS($ns,'infData'); | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | return unless $infdata->size(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $infdata=$infdata->shift()->getChildrenByTagNameNS($ns,'contact'); | |||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | return unless $infdata->size(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $infdata=$infdata->shift(); | |||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my $co=$rinfo->{contact}->{$oname}->{self}; | |||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my $t=$infdata->getChildrenByTagNameNS($ns,'type'); | |||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | $co->type($t->shift->getFirstChild()->getData()) if $t->size(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my $c=$infdata->getChildrenByTagNameNS($ns,'disclose'); | |||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if ($c->size()) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | { | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $c=$c->shift()->getFirstChild(); | |||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | $co->disclose({}) unless defined($co->disclose()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | while($c) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | next unless ($c->nodeType() == 1); ## only for element nodes | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | my $name=$c->localname() || $c->nodeName(); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$c->localname || $c->nodeName
MC/DC0%0/2
$c->localname || $c->nodeName
$c->localname
$c->nodeName
Truth table0%0/3
A || B
A= $c->localnameB= $c->nodeName
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | next unless $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $co->disclose()->{$name.'_loc'}=$c->getAttribute('flag'); | |||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | } continue { $c=$c->getNextSibling(); } | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | sub build_disclose | ||||||||||||||||||||||||||||||||||||||||||
| 117 | { | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | my ($rd,$type)=@_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_disclose: not called CC=17 SCAR=57.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | return () unless (defined($rd) && (ref($rd) eq 'HASH') && %$rd); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $rd and ref $rd eq "HASH" and %$rd
defined $rd and ref $rd eq "HASH"
MC/DC0%0/3
defined $rd and ref $rd eq "HASH" and %$rd
defined $rd
ref $rd eq "HASH"
%$rd
Truth table0%0/4
A and B and C
A= defined $rdB= ref $rd eq "HASH"C= %$rd
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my @d=(); | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | push @d,['dnslu:name',{flag=>$rd->{name_loc}}] if (exists($rd->{name_loc}) && Net::DRI::Util::xml_is_boolean($rd->{name_loc})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $rd->{"name_loc"} and Net::DRI::Util::xml_is_boolean($rd->{"name_loc"})
MC/DC0%0/2
exists $rd->{"name_loc"} and Net::DRI::Util::xml_is_boolean($rd->{"name_loc"})
exists $rd->{"name_loc"}
Net::DRI::Util::xml_is_boolean($rd->{"name_loc"})
Truth table0%0/3
A and B
A= exists $rd->{"name_loc"}B= Net::DRI::Util::xml_is_boolean($rd->{"name_loc"})
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | push @d,['dnslu:addr',{flag=>$rd->{addr_loc}}] if (exists($rd->{addr_loc}) && Net::DRI::Util::xml_is_boolean($rd->{addr_loc})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $rd->{"addr_loc"} and Net::DRI::Util::xml_is_boolean($rd->{"addr_loc"})
MC/DC0%0/2
exists $rd->{"addr_loc"} and Net::DRI::Util::xml_is_boolean($rd->{"addr_loc"})
exists $rd->{"addr_loc"}
Net::DRI::Util::xml_is_boolean($rd->{"addr_loc"})
Truth table0%0/3
A and B
A= exists $rd->{"addr_loc"}B= Net::DRI::Util::xml_is_boolean($rd->{"addr_loc"})
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if ($type eq 'contact') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | { | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | push @d,['dnslu:org',{flag=>$rd->{org_loc}}] if (exists($rd->{org_loc}) && Net::DRI::Util::xml_is_boolean($rd->{org_loc})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $rd->{"org_loc"} and Net::DRI::Util::xml_is_boolean($rd->{"org_loc"})
MC/DC0%0/2
exists $rd->{"org_loc"} and Net::DRI::Util::xml_is_boolean($rd->{"org_loc"})
exists $rd->{"org_loc"}
Net::DRI::Util::xml_is_boolean($rd->{"org_loc"})
Truth table0%0/3
A and B
A= exists $rd->{"org_loc"}B= Net::DRI::Util::xml_is_boolean($rd->{"org_loc"})
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | push @d,['dnslu:voice',{flag=>$rd->{voice}}] if (exists($rd->{voice}) && Net::DRI::Util::xml_is_boolean($rd->{voice})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $rd->{"voice"} and Net::DRI::Util::xml_is_boolean($rd->{"voice"})
MC/DC0%0/2
exists $rd->{"voice"} and Net::DRI::Util::xml_is_boolean($rd->{"voice"})
exists $rd->{"voice"}
Net::DRI::Util::xml_is_boolean($rd->{"voice"})
Truth table0%0/3
A and B
A= exists $rd->{"voice"}B= Net::DRI::Util::xml_is_boolean($rd->{"voice"})
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | push @d,['dnslu:fax',{flag=>$rd->{fax}}] if (exists($rd->{fax}) && Net::DRI::Util::xml_is_boolean($rd->{fax})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $rd->{"fax"} and Net::DRI::Util::xml_is_boolean($rd->{"fax"})
MC/DC0%0/2
exists $rd->{"fax"} and Net::DRI::Util::xml_is_boolean($rd->{"fax"})
exists $rd->{"fax"}
Net::DRI::Util::xml_is_boolean($rd->{"fax"})
Truth table0%0/3
A and B
A= exists $rd->{"fax"}B= Net::DRI::Util::xml_is_boolean($rd->{"fax"})
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | push @d,['dnslu:email',{flag=>$rd->{email}}] if (exists($rd->{email}) && Net::DRI::Util::xml_is_boolean($rd->{email})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $rd->{"email"} and Net::DRI::Util::xml_is_boolean($rd->{"email"})
MC/DC0%0/2
exists $rd->{"email"} and Net::DRI::Util::xml_is_boolean($rd->{"email"})
exists $rd->{"email"}
Net::DRI::Util::xml_is_boolean($rd->{"email"})
Truth table0%0/3
A and B
A= exists $rd->{"email"}B= Net::DRI::Util::xml_is_boolean($rd->{"email"})
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | return \@d; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | sub create | ||||||||||||||||||||||||||||||||||||||||||
| 134 | { | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | my ($epp,$contact)=@_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | ## validate() has been called, we are sure that type exists | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my @n; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | push @n,['dnslu:type',$contact->type()]; | |||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $rd=build_disclose($contact->disclose(),$contact->type()); | |||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | push @n,['dnslu:disclose',@$rd] if $rd; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $eid=$mes->command_extension_register('dnslu', 'ext'); | |||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $mes->command_extension($eid,['dnslu:create',['dnslu:contact',@n]]); | |||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | sub update | ||||||||||||||||||||||||||||||||||||||||||
| 150 | { | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my ($epp,$domain,$todo)=@_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my @n; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | push @n,['dnslu:add',['dnslu:disclose',@{build_disclose($todo->add('disclose'),'contact')}]] if $todo->add('disclose'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | push @n,['dnslu:rem',['dnslu:disclose',@{build_disclose($todo->del('disclose'),'contact')}]] if $todo->del('disclose'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | return unless @n; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $eid=$mes->command_extension_register('dnslu', 'ext'); | |||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $mes->command_extension($eid,['dnslu:update',['dnslu:contact',@n]]); | |||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | #################################################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||