« DRI/Protocol/EPP/Extensions/SIDN/Domain.pm
↑ Summary
DRI/Protocol/EPP/Extensions/AusRegistry/KeyValue.pm »
| 1 | ## Domain Registry Interface, EPP AusRegistry IDN 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::IDN; | ||||||||||||||||||||||||||||
| 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 => [ undef , \&info_parse ], | ||||||||||||||||||||||||||||
| 30 | create => [ \&create_build, \&create_parse ], | ||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | return { 'domain' => \%tmp }; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | sub setup | ||||||||||||||||||||||||||||
| 37 | { | ||||||||||||||||||||||||||||
| 38 | 0 | ▶ | my ($class,$po,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | 0 | $po->ns({ 'idn' => 'urn:X-ar:params:xml:ns:idnadomain-1.0' }); | |||||||||||||||||||||||||||
| 40 | 0 | return; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | #################################################################################################### | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | sub parse_idn | ||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||
| 47 | 0 | ▶ | my ($rh,$data)=@_; | ||||||||||||||||||||||||||
|
Subroutine
parse_idn: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | my %idn; | |||||||||||||||||||||||||||
| 50 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($data)) | |||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||
| 52 | 0 | my ($name,$node)=@$el; | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | if ($name eq 'userForm') | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 54 | { | ||||||||||||||||||||||||||||
| 55 | 0 | $idn{user_form}=$node->textContent(); | |||||||||||||||||||||||||||
| 56 | 0 | $idn{language}=$node->getAttribute('language'); | |||||||||||||||||||||||||||
| 57 | } elsif ($name eq 'canonicalForm') | ||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||
| 59 | 0 | $idn{canonical_form}=$node->textContent(); | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | $rh->{idn}=\%idn; | |||||||||||||||||||||||||||
| 64 | 0 | $rh->{language}=$idn{language}; ## compatibility mode with other IDN extensions | |||||||||||||||||||||||||||
| 65 | 0 | return; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | ## <extension> | ||||||||||||||||||||||||||||
| 69 | ## <infData xmlns="urn:X-ar:params:xml:ns:idnadomain-1.0"> | ||||||||||||||||||||||||||||
| 70 | ## <userForm language="gr">ως.example</userForm> | ||||||||||||||||||||||||||||
| 71 | ## <canonicalForm>ως.example</canonicalForm> | ||||||||||||||||||||||||||||
| 72 | ## </infData> | ||||||||||||||||||||||||||||
| 73 | ## </extension> | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | sub info_parse | ||||||||||||||||||||||||||||
| 76 | { | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
info_parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 79 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | my $data=$mes->get_extension('idn','infData'); | |||||||||||||||||||||||||||
| 82 | 0 | ▶ | return unless defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | parse_idn($rinfo->{domain}->{$oname},$data); | |||||||||||||||||||||||||||
| 85 | 0 | return; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | ## (In documentation, XML exemple is wrong, text is OK) | ||||||||||||||||||||||||||||
| 89 | ## | ||||||||||||||||||||||||||||
| 90 | ## <extension> | ||||||||||||||||||||||||||||
| 91 | ## <create xmlns="urn:X-ar:params:xml:ns:idnadomain-1.0"> | ||||||||||||||||||||||||||||
| 92 | ## <userForm language="gr">ως.example</userForm> | ||||||||||||||||||||||||||||
| 93 | ## </create> | ||||||||||||||||||||||||||||
| 94 | ## </extension> | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | sub create_build | ||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my ($epp,$domain,$rd)=@_; | ||||||||||||||||||||||||||
|
Subroutine
create_build: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 99 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | return unless Net::DRI::Util::has_key($rd,'idn'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters(q{Value for "idn" key must be a ref hash, not: }.$rd->{idn}) unless $rd->{idn} eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters(q{IDN ref hash must have a language key}) unless exists $rd->{idn}->{language} && defined $rd->{idn}->{language}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $rd->{"idn"}{"language"} and defined $rd->{"idn"}{"language"}
MC/DC0%0/2
exists $rd->{"idn"}{"language"} and defined $rd->{"idn"}{"language"}
exists $rd->{"idn"}{"language"}
defined $rd->{"idn"}{"language"}
Truth table0%0/3
A and B
A= exists $rd->{"idn"}{"language"}B= defined $rd->{"idn"}{"language"}
| |||||||||||||||||||||||||||||
| 105 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters(q{IDN language tag value must be of type XML schema language}) unless Net::DRI::Util::xml_is_language($rd->{idn}->{language}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters(q{IDN ref hash must have a user_form key}) unless exists $rd->{idn}->{user_form} && defined $rd->{idn}->{user_form}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $rd->{"idn"}{"user_form"} and defined $rd->{"idn"}{"user_form"}
MC/DC0%0/2
exists $rd->{"idn"}{"user_form"} and defined $rd->{"idn"}{"user_form"}
exists $rd->{"idn"}{"user_form"}
defined $rd->{"idn"}{"user_form"}
Truth table0%0/3
A and B
A= exists $rd->{"idn"}{"user_form"}B= defined $rd->{"idn"}{"user_form"}
| |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters(q{IDN user_form value must be of type XML token from 1 to 255 characters}) unless Net::DRI::Util::xml_is_token($rd->{idn}->{user_form},1,255); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 0 | my $eid=$mes->command_extension_register('idn','create'); | |||||||||||||||||||||||||||
| 110 | 0 | $mes->command_extension($eid,['userForm',{language => $rd->{idn}->{language}},$rd->{idn}->{user_form}]); | |||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | return; | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | ## <extension> | ||||||||||||||||||||||||||||
| 116 | ## <creData xmlns="urn:X-ar:params:xml:ns:idnadomain-1.0"> | ||||||||||||||||||||||||||||
| 117 | ## <userForm language="gr">ως.example</userForm> | ||||||||||||||||||||||||||||
| 118 | ## <canonicalForm>ως.example</canonicalForm> | ||||||||||||||||||||||||||||
| 119 | ## </creData> | ||||||||||||||||||||||||||||
| 120 | ## </extension> | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | sub create_parse | ||||||||||||||||||||||||||||
| 123 | { | ||||||||||||||||||||||||||||
| 124 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
create_parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 125 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 126 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | my $data=$mes->get_extension('idn','creData'); | |||||||||||||||||||||||||||
| 129 | 0 | ▶ | return unless defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | parse_idn($rinfo->{domain}->{$oname},$data); | |||||||||||||||||||||||||||
| 132 | 0 | return; | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | #################################################################################################### | ||||||||||||||||||||||||||||
| 137 | 1 | 1; | |||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | __END__ | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | =pod | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | =head1 NAME | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | Net::DRI::Protocol::EPP::Extensions::AusRegistry::IDN - EPP AusRegistry IDN commands for Net::DRI | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | Please see the README file for details. | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | Copyright (c) 2013,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 172 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 173 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 174 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | =cut | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||