| 1 | ## Domain Registry Interface, VeriSign EPP Suggestion Extension | ||||||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2010,2012,2013,2016,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::VeriSign::Suggestion; | ||||||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||||||
| 29 | 0 | return { 'domain' => { 'suggestion' => [ \&suggestion, \&parse ], | |||||||||||||||||||||||||||||||
| 30 | } }; | ||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | sub setup | ||||||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | my ($class,$po,$version)=@_; | ||||||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 36 | 0 | $po->ns({ 'suggestion' => 'http://www.verisign-grs.com/epp/suggestion-1.1' }); | |||||||||||||||||||||||||||||||
| 37 | 0 | return; | |||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | #################################################################################################### | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | sub suggestion | ||||||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | my ($epp,$domain,$rd)=@_; | ||||||||||||||||||||||||||||||
|
Subroutine
suggestion: not called CC=42 SCAR=75.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters('suggestion domain/key must be a string') unless Net::DRI::Util::xml_is_string($domain); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 47 | 0 | my @d; | |||||||||||||||||||||||||||||||
| 48 | 0 | push @d,['suggestion:key',$domain]; | |||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'language')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('language value must be of XML language type') unless Net::DRI::Util::xml_is_language($rd->{language}); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 53 | 0 | push @d,['suggestion:language',$rd->{language}]; | |||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 0 | my @f; | |||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'filter_id')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('filter_id must be an integer') unless $rd->{filter_id}=~m/^\d+$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 60 | 0 | push @d,['suggestion:filterid',$rd->{filter_id}]; | |||||||||||||||||||||||||||||||
| 61 | } else | ||||||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||||||
| 63 | 0 | my %f; | |||||||||||||||||||||||||||||||
| 64 | 0 | foreach my $k (qw/contentfilter customfilter usehyphens usenumbers useidns/) | |||||||||||||||||||||||||||||||
| 65 | { | ||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | $f{$k}=$rd->{$k} if Net::DRI::Util::has_key($rd,$k) && Net::DRI::Util::xml_is_boolean($rd->{$k}); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Net::DRI::Util::has_key($rd, $k) and Net::DRI::Util::xml_is_boolean($rd->{$k})
MC/DC0%0/2
Net::DRI::Util::has_key($rd, $k) and Net::DRI::Util::xml_is_boolean($rd->{$k})
Net::DRI::Util::has_key($rd, $k)
Net::DRI::Util::xml_is_boolean($rd->{$k})
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, $k)B= Net::DRI::Util::xml_is_boolean($rd->{$k})
| |||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'view')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('view must be either table or grid') unless $rd->{view}=~m/^(?:table|grid)$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 71 | 0 | $f{view}=$rd->{view}; | |||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'forsale')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 74 | { | ||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('forsale must be either off, low, medium or high') unless $rd->{forsale}=~m/^(?:off|low|medium|high)$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 76 | 0 | $f{forsale}=$rd->{forsale}; | |||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'maxlength')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('maxlength must be a number between 1 and 63') unless Net::DRI::Util::verify_int($rd->{maxlength},1,63); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 81 | 0 | $f{maxlength}=$rd->{maxlength}; | |||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'maxresults')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 84 | { | ||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('maxresults must be a number between 1 and 100') unless Net::DRI::Util::verify_int($rd->{maxresults},1,100); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 86 | 0 | $f{maxresults}=$rd->{maxresults}; | |||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'action') && ref $rd->{action} eq 'HASH') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Net::DRI::Util::has_key($rd, "action") and ref $rd->{"action"} eq "HASH"
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "action") and ref $rd->{"action"} eq "HASH"
Net::DRI::Util::has_key($rd, "action")
ref $rd->{"action"} eq "HASH"
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "action")B= ref $rd->{"action"} eq "HASH"
| |||||||||||||||||||||||||||||||||
| 90 | { | ||||||||||||||||||||||||||||||||
| 91 | 0 | foreach my $action (sort { $a cmp $b } keys %{$rd->{action}}) | |||||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||||||
| 93 | 0 | my $weight=$rd->{action}->{$action}; | |||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters(sprintf('weight for action "%s" myst be either off, low, medium or high',$action)) unless defined $weight && $weight=~/^(?:off|low|medium|high)$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $weight and $weight =~ /^(?:off|low|medium|high)$/
MC/DC0%0/2
defined $weight and $weight =~ /^(?:off|low|medium|high)$/
defined $weight
$weight =~ /^(?:off|low|medium|high)$/
Truth table0%0/3
A and B
A= defined $weightB= $weight =~ /^(?:off|low|medium|high)$/
| |||||||||||||||||||||||||||||||||
| 95 | 0 | push @f,['suggestion:action',{name => $action, weight => $weight }]; | |||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'tld')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 99 | { | ||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | foreach my $tld (ref $rd->{tld} eq 'ARRAY' ? @{$rd->{tld}} : ($rd->{tld})) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters(sprintf('TLD must be 1 to 255 characters and not: ',defined $tld ? $tld : '<undef>')) unless Net::DRI::Util::xml_is_token($tld,1,255); | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 103 | 0 | push @f,['suggestion:tld',$tld]; | |||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'geo') && ref $rd->{geo} eq 'HASH') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Net::DRI::Util::has_key($rd, "geo") and ref $rd->{"geo"} eq "HASH"
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "geo") and ref $rd->{"geo"} eq "HASH"
Net::DRI::Util::has_key($rd, "geo")
ref $rd->{"geo"} eq "HASH"
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "geo")B= ref $rd->{"geo"} eq "HASH"
| |||||||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if (exists $rd->{geo}->{lat} && exists $rd->{geo}->{lon}) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
exists $rd->{"geo"}{"lat"} and exists $rd->{"geo"}{"lon"}
MC/DC0%0/2
exists $rd->{"geo"}{"lat"} and exists $rd->{"geo"}{"lon"}
exists $rd->{"geo"}{"lat"}
exists $rd->{"geo"}{"lon"}
Truth table0%0/3
A and B
A= exists $rd->{"geo"}{"lat"}B= exists $rd->{"geo"}{"lon"}
| |||||||||||||||||||||||||||||||||
| 109 | { | ||||||||||||||||||||||||||||||||
| 110 | 0 | my $lat = $rd->{geo}->{lat}; | |||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('geo latitude must be a decimal with at most 6 decimal digits, between -90 and +90') unless Net::DRI::Util::xml_is_decimal($lat, 6, undef, -90, 90); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 112 | 0 | my $lon = $rd->{geo}->{lon}; | |||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('geo longitude must be a decimal with at most 6 decimal digits, between -180 and +180') unless Net::DRI::Util::xml_is_decimal($lat, 6, undef, -180, 180); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 114 | 0 | push @f,['suggestion:geo',['suggestion:coordinates', { lat => $lat, lon => $lon } ]]; | |||||||||||||||||||||||||||||||
| 115 | } elsif (exists $rd->{geo}->{addr}) | ||||||||||||||||||||||||||||||||
| 116 | { | ||||||||||||||||||||||||||||||||
| 117 | 0 | my $addr = $rd->{geo}->{addr}; | |||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('geo addr must be an XML token with 3 to 45 characters') unless Net::DRI::Util::xml_is_token($addr, 3, 45); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | my $ip = exist $rd->{geo}->{ip} ? $rd->{geo}->{ip} : 'v4'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('geo ip must be v4 or v6 string') unless $ip=~m/^v[46]$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 121 | 0 | push @f,['suggestion:geo',['suggestion:addr',{ ip => $ip }, $addr]]; | |||||||||||||||||||||||||||||||
| 122 | } else | ||||||||||||||||||||||||||||||||
| 123 | { | ||||||||||||||||||||||||||||||||
| 124 | 0 | Net::DRI::Exception::usererr_insufficient_parameters('geo data should have either lat+lon keys or addr/addr+ip keys'); | |||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | @f=(['suggestion:filter',\%f,@f]) if %f || @f; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
%f or @f
MC/DC0%0/2
%f or @f
%f
@f
Truth table0%0/3
A or B
A= %fB= @f
| |||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | push @d,@f if @f; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | if (Net::DRI::Util::has_key($rd, 'sub_id')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 133 | { | ||||||||||||||||||||||||||||||||
| 134 | 0 | my $subid=$rd->{sub_id}; | |||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('if provided sub_id value must be an XML token') unless Net::DRI::Util::xml_is_token($subid); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 136 | 0 | push @d,['suggestion:subID', $subid]; | |||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||
| 139 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||||||
| 140 | 0 | $mes->command(['info','suggestion:info', $mes->nsattrs('suggestion')]); | |||||||||||||||||||||||||||||||
| 141 | 0 | $mes->command_body(\@d); | |||||||||||||||||||||||||||||||
| 142 | 0 | return; | |||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||
| 145 | sub parse | ||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||||||
|
Subroutine
parse: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 148 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||
| 151 | 0 | my $infdata=$mes->get_response('suggestion','infData'); | |||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | return unless defined $infdata; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||
| 154 | 0 | my $key; | |||||||||||||||||||||||||||||||
| 155 | 0 | my $ns=$mes->ns('suggestion'); | |||||||||||||||||||||||||||||||
| 156 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($infdata)) | |||||||||||||||||||||||||||||||
| 157 | { | ||||||||||||||||||||||||||||||||
| 158 | 0 | my ($n,$c)=@$el; | |||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | if ($n eq 'key') | ||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||
| 160 | { | ||||||||||||||||||||||||||||||||
| 161 | 0 | $key=$c->textContent(); | |||||||||||||||||||||||||||||||
| 162 | 0 | $rinfo->{domain}->{$key}->{action}='suggest'; | |||||||||||||||||||||||||||||||
| 163 | 0 | $rinfo->{domain}->{$key}->{suggestions}={}; | |||||||||||||||||||||||||||||||
| 164 | } elsif ($n eq 'language') | ||||||||||||||||||||||||||||||||
| 165 | { | ||||||||||||||||||||||||||||||||
| 166 | 0 | $rinfo->{domain}->{$key}->{suggestions}->{language}='ENG'; | |||||||||||||||||||||||||||||||
| 167 | } elsif ($n eq 'token') | ||||||||||||||||||||||||||||||||
| 168 | { | ||||||||||||||||||||||||||||||||
| 169 | 0 | $rinfo->{domain}->{$key}->{suggestions}->{tokens}->{$c->getAttribute('name')}=[ map { $_->textContent() } (Net::DRI::Util::xml_traverse($c,$ns,'related')) ]; | |||||||||||||||||||||||||||||||
| 170 | } elsif ($n eq 'answer') | ||||||||||||||||||||||||||||||||
| 171 | { | ||||||||||||||||||||||||||||||||
| 172 | 0 | my $ans=Net::DRI::Util::xml_traverse($c,$ns,'table'); | |||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if (defined $ans) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 174 | { | ||||||||||||||||||||||||||||||||
| 175 | 0 | $rinfo->{domain}->{$key}->{suggestions}->{result_type}='table'; | |||||||||||||||||||||||||||||||
| 176 | 0 | $rinfo->{domain}->{$key}->{suggestions}->{answer}=parse_table($ans,$ns); | |||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||
| 178 | 0 | $ans=Net::DRI::Util::xml_traverse($c,$ns,'grid'); | |||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if (defined $ans) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 180 | { | ||||||||||||||||||||||||||||||||
| 181 | 0 | $rinfo->{domain}->{$key}->{suggestions}->{result_type}='grid'; | |||||||||||||||||||||||||||||||
| 182 | 0 | $rinfo->{domain}->{$key}->{suggestions}->{answer}=parse_grid($ans,$ns); | |||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||
| 186 | 0 | return; | |||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||
| 189 | sub parse_table | ||||||||||||||||||||||||||||||||
| 190 | { | ||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | my ($node,$ns)=@_; | ||||||||||||||||||||||||||||||
|
Subroutine
parse_table: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 192 | 0 | my %r; | |||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||
| 194 | 0 | foreach my $row (Net::DRI::Util::xml_traverse($node,$ns,'row')) | |||||||||||||||||||||||||||||||
| 195 | { | ||||||||||||||||||||||||||||||||
| 196 | 0 | my %d; | |||||||||||||||||||||||||||||||
| 197 | 0 | my $name=$row->getAttribute('name'); | |||||||||||||||||||||||||||||||
| 198 | 0 | $d{score}=0+$row->getAttribute('score'); | |||||||||||||||||||||||||||||||
| 199 | 0 | $d{status}=$row->getAttribute('status'); | |||||||||||||||||||||||||||||||
| 200 | 0 | foreach my $key (qw/source morelikethis ppcvalue uName/) | |||||||||||||||||||||||||||||||
| 201 | { | ||||||||||||||||||||||||||||||||
| 202 | 0 | my $v=$row->getAttribute($key); | |||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | next unless defined $v; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 204 | 0 | $d{lc $key}=$v; | |||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||
| 206 | 0 | $r{$name}=\%d; | |||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||
| 208 | 0 | return \%r; | |||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||
| 212 | sub parse_grid | ||||||||||||||||||||||||||||||||
| 213 | { | ||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | my ($node,$ns)=@_; | ||||||||||||||||||||||||||||||
|
Subroutine
parse_grid: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 215 | 0 | my %r; | |||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||
| 217 | 0 | foreach my $row (Net::DRI::Util::xml_traverse($node,$ns,'record')) | |||||||||||||||||||||||||||||||
| 218 | { | ||||||||||||||||||||||||||||||||
| 219 | 0 | my %d; | |||||||||||||||||||||||||||||||
| 220 | 0 | my $name=$row->getAttribute('name'); | |||||||||||||||||||||||||||||||
| 221 | 0 | foreach my $key (qw/source morelikethis ppcvalue/) | |||||||||||||||||||||||||||||||
| 222 | { | ||||||||||||||||||||||||||||||||
| 223 | 0 | my $v=$row->getAttribute($key); | |||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | next unless defined $v; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 225 | 0 | $d{$key}=$v; | |||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||
| 227 | 0 | my %rr; | |||||||||||||||||||||||||||||||
| 228 | 0 | foreach my $cell (Net::DRI::Util::xml_traverse($row,$ns,'cell')) | |||||||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||||||
| 230 | 0 | my $tld=$cell->getAttribute('tld'); | |||||||||||||||||||||||||||||||
| 231 | 0 | $rr{$tld}={ score => 0+$cell->getAttribute('score'), status => $cell->getAttribute('status'), %d }; | |||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | $rr{$tld}->{utld}=$cell->getAttribute('uTld') if $cell->hasAttribute('uTld'); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||
| 234 | 0 | $r{$name}=\%rr; | |||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||
| 236 | 0 | return \%r; | |||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||
| 238 | ######################################################################################################### | ||||||||||||||||||||||||||||||||
| 239 | 1 | 1; | |||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||
| 241 | __END__ | ||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||
| 243 | =pod | ||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||
| 245 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||
| 247 | Net::DRI::Protocol::EPP::Extensions::VeriSign::Suggestion - VeriSign EPP Suggestion Extension for Net::DRI | ||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||
| 249 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||
| 251 | $dri=Net::DRI->new(); | ||||||||||||||||||||||||||||||||
| 252 | $dri->add_registry('VeriSign::NameStore',{client_id=>'XXXXXX'); | ||||||||||||||||||||||||||||||||
| 253 | $dri->add_profile(...); | ||||||||||||||||||||||||||||||||
| 254 | $dri->domain_suggest('whatever.tv',{...}); | ||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||
| 256 | This extension is loaded by default during add_profile. | ||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||
| 258 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||
| 260 | Please see the README file for details. | ||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||
| 262 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||
| 264 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||
| 266 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||
| 268 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||
| 270 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||
| 272 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||
| 274 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||
| 276 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||
| 278 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||
| 280 | Copyright (c) 2010,2012,2013,2016,2018 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||||||||||||||||
| 281 | All rights reserved. | ||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||
| 283 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||
| 284 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||
| 285 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||||||
| 286 | (at your option) any later version. | ||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||
| 288 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||
| 290 | =cut | ||||||||||||||||||||||||||||||||