| 1 | ## Domain Registry Interface, EPP AusRegistry Domain Variant Extension | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2013,2018 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::AusRegistry::Variant; | ||||||||||||||||||||||||||||
| 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 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | #################################################################################################### | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | sub register_commands | ||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||
| 27 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 0 | my %tmp=( | |||||||||||||||||||||||||||
| 29 | info => [ \&info_build, \&info_parse ], | ||||||||||||||||||||||||||||
| 30 | create => [ undef, \&create_parse ], | ||||||||||||||||||||||||||||
| 31 | update => [ \&update_build, undef ], | ||||||||||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | return { 'domain' => \%tmp }; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | sub setup | ||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||
| 39 | 0 | ▶ | my ($class,$po,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 0 | $po->ns({ 'variant' => 'urn:X-ar:params:xml:ns:variant-1.0' }); | |||||||||||||||||||||||||||
| 41 | 0 | return; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub capabilities_add { return ('domain_update','variants',['add','del']); } | ||||||||||||||||||||||||||
|
Subroutine
capabilities_add: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | #################################################################################################### | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | ## (This extension is mandatory) | ||||||||||||||||||||||||||||
| 49 | ## <extension> | ||||||||||||||||||||||||||||
| 50 | ## <info xmlns="urn:X-ar:params:xml:ns:variant-1.0" variants="all"/> | ||||||||||||||||||||||||||||
| 51 | ## </extension> | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | sub info_build | ||||||||||||||||||||||||||||
| 54 | { | ||||||||||||||||||||||||||||
| 55 | 0 | ▶ | my ($epp,$domain,$rd)=@_; | ||||||||||||||||||||||||||
|
Subroutine
info_build: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | my $variants='all'; ## default value | |||||||||||||||||||||||||||
| 59 | 0 | ▶ | $variants=$rd->{variants} if Net::DRI::Util::has_key($rd,'variants') && $rd->{variants}=~m/^(?:all|none)$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Net::DRI::Util::has_key($rd, "variants") and $rd->{"variants"} =~ /^(?:all|none)$/
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "variants") and $rd->{"variants"} =~ /^(?:all|none)$/
Net::DRI::Util::has_key($rd, "variants")
$rd->{"variants"} =~ /^(?:all|none)$/
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "variants")B= $rd->{"variants"} =~ /^(?:all|none)$/
| |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | my $eid=$mes->command_extension_register('variant','info',{variants => $variants}); | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | return; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | ## <extension> | ||||||||||||||||||||||||||||
| 67 | ## <infData xmlns="urn:X-ar:params:xml:ns:variant-1.0"> | ||||||||||||||||||||||||||||
| 68 | ## <variant userForm="ωσ.example">xn--4xal.example</variant> | ||||||||||||||||||||||||||||
| 69 | ## </infData> | ||||||||||||||||||||||||||||
| 70 | ## </extension> | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | sub parse_variant | ||||||||||||||||||||||||||||
| 73 | { | ||||||||||||||||||||||||||||
| 74 | 0 | ▶ | my ($rh,$data)=@_; | ||||||||||||||||||||||||||
|
Subroutine
parse_variant: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | my %variants; | |||||||||||||||||||||||||||
| 77 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($data)) | |||||||||||||||||||||||||||
| 78 | { | ||||||||||||||||||||||||||||
| 79 | 0 | my ($name,$node)=@$el; | |||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ($name eq 'variant') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | { | ||||||||||||||||||||||||||||
| 82 | 0 | $variants{$node->textContent()}=$node->getAttribute('userForm'); ## A-label => U-label | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | $rh->{variants}=\%variants; | |||||||||||||||||||||||||||
| 87 | 0 | return; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | sub info_parse | ||||||||||||||||||||||||||||
| 91 | { | ||||||||||||||||||||||||||||
| 92 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
info_parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 93 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 94 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | my $data=$mes->get_extension('variant','infData'); | |||||||||||||||||||||||||||
| 97 | 0 | ▶ | return unless defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 0 | parse_variant($rinfo->{domain}->{$oname},$data); | |||||||||||||||||||||||||||
| 100 | 0 | return; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | ## <extension> | ||||||||||||||||||||||||||||
| 104 | ## <creData xmlns="urn:X-ar:params:xml:ns:variant-1.0"> | ||||||||||||||||||||||||||||
| 105 | ## <variant userForm="ωσ.example">xn--4xal.example</variant> | ||||||||||||||||||||||||||||
| 106 | ## </creData> | ||||||||||||||||||||||||||||
| 107 | ## </extension> | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | sub create_parse | ||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
create_parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 112 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 113 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 0 | my $data=$mes->get_extension('variant','creData'); | |||||||||||||||||||||||||||
| 116 | 0 | ▶ | return unless defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | parse_variant($rinfo->{domain}->{$oname},$data); | |||||||||||||||||||||||||||
| 119 | 0 | return; | |||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | ## <extension> | ||||||||||||||||||||||||||||
| 123 | ## <update xmlns="urn:X-ar:params:xml:ns:variant-1.0"> | ||||||||||||||||||||||||||||
| 124 | ## <add> | ||||||||||||||||||||||||||||
| 125 | ## <variant userForm="ωσ.example">xn--4xal.example</variant> | ||||||||||||||||||||||||||||
| 126 | ## </add> | ||||||||||||||||||||||||||||
| 127 | ## </update> | ||||||||||||||||||||||||||||
| 128 | ## </extension> | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | ## <extension> | ||||||||||||||||||||||||||||
| 131 | ## <update xmlns="urn:X-ar:params:xml:ns:variant-1.0"> | ||||||||||||||||||||||||||||
| 132 | ## <rem> | ||||||||||||||||||||||||||||
| 133 | ## <variant userForm="ωσ.example">xn--4xal.example</variant> | ||||||||||||||||||||||||||||
| 134 | ## </rem> | ||||||||||||||||||||||||||||
| 135 | ## </update> | ||||||||||||||||||||||||||||
| 136 | ## </extension> | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | sub build_variants | ||||||||||||||||||||||||||||
| 139 | { | ||||||||||||||||||||||||||||
| 140 | 0 | ▶ | my ($d)=@_; | ||||||||||||||||||||||||||
|
Subroutine
build_variants: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | my @v; | |||||||||||||||||||||||||||
| 143 | 0 | foreach my $alabel ( sort { $a cmp $b } keys %$d) | |||||||||||||||||||||||||||
| 144 | { | ||||||||||||||||||||||||||||
| 145 | 0 | push @v,['variants:variant',{userForm => $d->{$alabel}},$alabel]; | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | return @v; | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | sub update_build | ||||||||||||||||||||||||||||
| 152 | { | ||||||||||||||||||||||||||||
| 153 | 0 | ▶ | my ($epp,$domain,$todo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
update_build: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 154 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | my $toadd=$todo->add('variants'); | |||||||||||||||||||||||||||
| 157 | 0 | my $todel=$todo->del('variants'); | |||||||||||||||||||||||||||
| 158 | 0 | ▶ | return unless defined $toadd || defined $todel; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $toadd or defined $todel
MC/DC0%0/2
defined $toadd or defined $todel
defined $toadd
defined $todel
Truth table0%0/3
A or B
A= defined $toaddB= defined $todel
| |||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 0 | my $eid=$mes->command_extension_register('variants','update'); | |||||||||||||||||||||||||||
| 161 | 0 | my @v; | |||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 0 | ▶ | if (defined $toadd) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||
| 165 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters(q{add variants value must be a ref hash, not: }.$toadd) unless ref $toadd eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | 0 | push @v,['variants:add',build_variants($toadd)]; | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if (defined $todel) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | { | ||||||||||||||||||||||||||||
| 170 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters(q{del variants value must be a ref hash, not: }.$todel) unless ref $todel eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | 0 | push @v,['variants:rem',build_variants($todel)]; | |||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 0 | $mes->command_extension($eid,\@v); | |||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 0 | return; | |||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | #################################################################################################### | ||||||||||||||||||||||||||||
| 180 | 1 | 1; | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | __END__ | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | =pod | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | =head1 NAME | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | Net::DRI::Protocol::EPP::Extensions::AusRegistry::Variant - EPP AusRegistry Domain Variant commands for Net::DRI | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | Please see the README file for details. | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | Copyright (c) 2013,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 215 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 216 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 217 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | =cut | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||