« DRI/Protocol/EPP/Extensions/Nominet/Contact.pm
↑ Summary
DRI/Protocol/EPP/Extensions/VeriSign/PollRGP.pm »
| 1 | ## Domain Registry Interface, EPP IDN (draft-ietf-eppext-idnmap-02) | ||||||||||||||
| 2 | ## | ||||||||||||||
| 3 | ## Copyright (c) 2013,2015,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::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, undef ], | ||||||||||||||
| 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:ietf:params:xml:ns:idn-1.0' }); | |||||||||||||
| 40 | 0 | return; | |||||||||||||
| 41 | } | ||||||||||||||
| 42 | |||||||||||||||
| 43 | #################################################################################################### | ||||||||||||||
| 44 | |||||||||||||||
| 45 | sub info_parse | ||||||||||||||
| 46 | { | ||||||||||||||
| 47 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||
|
Subroutine
info_parse: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||
| 48 | 0 | my $mes=$po->message(); | |||||||||||||
| 49 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 50 | |||||||||||||||
| 51 | 0 | my $data=$mes->get_extension('idn','data'); | |||||||||||||
| 52 | 0 | ▶ | return unless defined $data; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 53 | |||||||||||||||
| 54 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($data)) | |||||||||||||
| 55 | { | ||||||||||||||
| 56 | 0 | my ($name,$node)=@$el; | |||||||||||||
| 57 | 0 | ▶ | if ($name eq 'table') | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 58 | { | ||||||||||||||
| 59 | 0 | $rinfo->{domain}->{$oname}->{idn_table}=$node->textContent(); | |||||||||||||
| 60 | } elsif ($name eq 'uname') | ||||||||||||||
| 61 | { | ||||||||||||||
| 62 | 0 | $rinfo->{domain}->{$oname}->{uname}=$node->textContent(); ## domain name in unicode NFC form | |||||||||||||
| 63 | } | ||||||||||||||
| 64 | } | ||||||||||||||
| 65 | |||||||||||||||
| 66 | 0 | return; | |||||||||||||
| 67 | } | ||||||||||||||
| 68 | |||||||||||||||
| 69 | sub create_build | ||||||||||||||
| 70 | { | ||||||||||||||
| 71 | 0 | ▶ | my ($epp,$domain,$rd)=@_; | ||||||||||||
|
Subroutine
create_build: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||
| 72 | 0 | my $mes=$epp->message(); | |||||||||||||
| 73 | |||||||||||||||
| 74 | 0 | ▶ | return unless $domain=~m/^xn--/; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 75 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters('For IDNs, an idn_table must be provided') unless Net::DRI::Util::has_key($rd,'idn_table'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 76 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('idn_table must be of type XML schema token with at least 1 character') unless Net::DRI::Util::xml_is_token($rd->{idn_table},1); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 77 | 0 | my @d; | |||||||||||||
| 78 | 0 | push @d,['idn:table',$rd->{idn_table}]; | |||||||||||||
| 79 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'uname')) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 80 | { | ||||||||||||||
| 81 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('uname must be of type XML schema token from 1 to 255 characters') unless Net::DRI::Util::xml_is_token($rd->{uname},1,255); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 82 | 0 | push @d,['idn:uname',$rd->{uname}]; | |||||||||||||
| 83 | } | ||||||||||||||
| 84 | |||||||||||||||
| 85 | 0 | my $eid=$mes->command_extension_register('idn','data'); | |||||||||||||
| 86 | 0 | $mes->command_extension($eid,\@d); | |||||||||||||
| 87 | |||||||||||||||
| 88 | 0 | return; | |||||||||||||
| 89 | } | ||||||||||||||
| 90 | |||||||||||||||
| 91 | #################################################################################################### | ||||||||||||||
| 92 | 1 | 1; | |||||||||||||
| 93 | |||||||||||||||
| 94 | __END__ | ||||||||||||||
| 95 | |||||||||||||||
| 96 | =pod | ||||||||||||||
| 97 | |||||||||||||||
| 98 | =head1 NAME | ||||||||||||||
| 99 | |||||||||||||||
| 100 | Net::DRI::Protocol::EPP::Extensions::IDN - EPP IDN commands (draft-ietf-eppext-idnmap-02) for Net::DRI | ||||||||||||||
| 101 | |||||||||||||||
| 102 | =head1 DESCRIPTION | ||||||||||||||
| 103 | |||||||||||||||
| 104 | Please see the README file for details. | ||||||||||||||
| 105 | |||||||||||||||
| 106 | =head1 SUPPORT | ||||||||||||||
| 107 | |||||||||||||||
| 108 | For now, support questions should be sent to: | ||||||||||||||
| 109 | |||||||||||||||
| 110 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||
| 111 | |||||||||||||||
| 112 | Please also see the SUPPORT file in the distribution. | ||||||||||||||
| 113 | |||||||||||||||
| 114 | =head1 SEE ALSO | ||||||||||||||
| 115 | |||||||||||||||
| 116 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||
| 117 | |||||||||||||||
| 118 | =head1 AUTHOR | ||||||||||||||
| 119 | |||||||||||||||
| 120 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||
| 121 | |||||||||||||||
| 122 | =head1 COPYRIGHT | ||||||||||||||
| 123 | |||||||||||||||
| 124 | Copyright (c) 2013,2015,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||
| 125 | |||||||||||||||
| 126 | This program is free software; you can redistribute it and/or modify | ||||||||||||||
| 127 | it under the terms of the GNU General Public License as published by | ||||||||||||||
| 128 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||
| 129 | (at your option) any later version. | ||||||||||||||
| 130 | |||||||||||||||
| 131 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||
| 132 | |||||||||||||||
| 133 | =cut | ||||||||||||||
| 134 | |||||||||||||||