| 1 | package WWW::eNom::Role::Command::Domain::PrivateNameServer; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 47 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 47 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 47 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 47 | ▶ | use MooseX::Params::Validate; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 47 | ▶ | use WWW::eNom::Types qw( Domain DomainName IP PrivateNameServer ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 47 | ▶ | use WWW::eNom::PrivateNameServer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 47 | ▶ | use Data::Util qw( is_string is_hash_ref is_array_ref ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 47 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 47 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 47 | requires 'submit', 'update_nameservers_for_domain_name', 'get_domain_by_name'; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 47 | our $VERSION = 'v2.7.0'; # VERSION | |||||||||||||||||||||||||||
| 21 | # ABSTRACT: Domain Private Nameserver Operations | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub create_private_nameserver { | ||||||||||||||||||||||||||
|
Subroutine
create_private_nameserver: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 25 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 26 | \@_, | ||||||||||||||||||||||||||||
| 27 | domain_name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 28 | private_nameserver => { isa => PrivateNameServer, coerce => 1 } | ||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 32 | 0 | my $domain = $self->get_domain_by_name( $args{domain_name} ); | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | my $response = $self->submit({ | ||||||||||||||||||||||||||||
| 35 | method => 'RegisterNameServer', | ||||||||||||||||||||||||||||
| 36 | params => { | ||||||||||||||||||||||||||||
| 37 | Add => 'true', | ||||||||||||||||||||||||||||
| 38 | NSName => $args{private_nameserver}->name, | ||||||||||||||||||||||||||||
| 39 | IP => $args{private_nameserver}->ip, | ||||||||||||||||||||||||||||
| 40 | }, | ||||||||||||||||||||||||||||
| 41 | 0 | }); | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | if( ( grep { $_ eq 'Domain ID not found.' } @{ $response->{errors} } ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
grep {$_ eq "Domain ID not found.";} @{$$response{"errors"};} or grep {$_ eq "Domain cannot be found.";} @{$$response{"errors"};}
MC/DC0%0/2
grep {$_ eq "Domain ID not found.";} @{$$response{"errors"};} or grep {$_ eq "Domain cannot be found.";} @{$$response{"errors"};}
grep {$_ eq "Domain ID not found.";} @{$$response{"errors"};}
grep {$_ eq "Domain cannot be found.";} @{$$response{"errors"};}
Truth table0%0/3
A or B
A= grep {$_ eq "Domain ID not found.";} @{$$response{"errors"};}B= grep {$_ eq "Domain cannot be found.";} @{$$response{"errors"};}
| |||||||||||||||||||||||||||||
| 45 | 0 | || ( grep { $_ eq 'Domain cannot be found.' } @{ $response->{errors} } ) ) { | |||||||||||||||||||||||||||
| 46 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if( grep { $_ eq 'This nameserver is already registered.' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | croak 'Private nameserver already registered'; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | my @new_domain_nameservers; | |||||||||||||||||||||||||||
| 57 | 0 | ▶ | if( $domain->has_private_nameservers ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | @new_domain_nameservers = ( | ||||||||||||||||||||||||||||
| 59 | 0 | @{ $domain->ns }, | |||||||||||||||||||||||||||
| 60 | $args{private_nameserver}->name, | ||||||||||||||||||||||||||||
| 61 | 0 | map { $_->name } @{ $domain->private_nameservers }, | |||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | else { | ||||||||||||||||||||||||||||
| 65 | 0 | @new_domain_nameservers = ( @{ $domain->ns }, $args{private_nameserver}->name ); | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | return $self->update_nameservers_for_domain_name( | |||||||||||||||||||||||||||
| 69 | domain_name => $domain->name, | ||||||||||||||||||||||||||||
| 70 | ns => \@new_domain_nameservers, | ||||||||||||||||||||||||||||
| 71 | ); | ||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 74 | 0 | croak $_; | |||||||||||||||||||||||||||
| 75 | 0 | }; | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub update_private_nameserver_ip { | ||||||||||||||||||||||||||
|
Subroutine
update_private_nameserver_ip: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 79 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 80 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 81 | \@_, | ||||||||||||||||||||||||||||
| 82 | name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 83 | old_ip => { isa => IP }, | ||||||||||||||||||||||||||||
| 84 | new_ip => { isa => IP }, | ||||||||||||||||||||||||||||
| 85 | ); | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if( $args{old_ip} eq $args{new_ip} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 0 | return $self->retrieve_private_nameserver_by_name( $args{name} ); | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 92 | my $response = $self->submit({ | ||||||||||||||||||||||||||||
| 93 | method => 'UpdateNameServer', | ||||||||||||||||||||||||||||
| 94 | params => { | ||||||||||||||||||||||||||||
| 95 | NS => $args{name}, | ||||||||||||||||||||||||||||
| 96 | OldIP => $args{old_ip}, | ||||||||||||||||||||||||||||
| 97 | NewIP => $args{new_ip}, | ||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | 0 | }); | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | if( grep { $_ eq 'Nameserver registration failed due to error 545: Object does not exist' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_ eq 'Nameserver registration failed due to error 545: Object does not exist' || $_ eq 'Domain cannot be found.'
MC/DC0%0/2
$_ eq 'Nameserver registration failed due to error 545: Object does not exist' || $_ eq 'Domain cannot be found.'
$_ eq 'Nameserver registration failed due to error 545: Object does not exist'
$_ eq 'Domain cannot be found.'
Truth table0%0/3
A || B
A= $_ eq 'Nameserver registration failed due to error 545: Object does not exist'B= $_ eq 'Domain cannot be found.'
| |||||||||||||||||||||||||||||
| 103 | 0 | || $_ eq 'Domain cannot be found.' } @{ $response->{errors} } ) { | |||||||||||||||||||||||||||
| 104 | 0 | croak 'Nameserver does not exist'; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if( grep { $_ eq 'Domain ID not found.' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | 0 | croak 'Nameserver not found in your account'; | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | ▶ | if( grep { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | 0 | $_ =~ m/failed due to error 541: Parameter value policy error;/ | |||||||||||||||||||||||||||
| 113 | 0 | } @{ $response->{errors} } ) { | |||||||||||||||||||||||||||
| 114 | 0 | croak 'Incorrect old_ip'; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if( !exists $response->{RegisterNameserver}{NsSuccess} || $response->{RegisterNameserver}{NsSuccess} != 1 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not exists $response->{"RegisterNameserver"}{"NsSuccess"} or $response->{"RegisterNameserver"}{"NsSuccess"} != 1
MC/DC0%0/2
not exists $response->{"RegisterNameserver"}{"NsSuccess"} or $response->{"RegisterNameserver"}{"NsSuccess"} != 1
not exists $response->{"RegisterNameserver"}{"NsSuccess"}
$response->{"RegisterNameserver"}{"NsSuccess"} != 1
Truth table0%0/3
not(A) or B
A= not exists $response->{"RegisterNameserver"}{"NsSuccess"}B= $response->{"RegisterNameserver"}{"NsSuccess"} != 1
| |||||||||||||||||||||||||||||
| 121 | 0 | croak 'Unable to update nameserver'; | |||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 0 | return $self->retrieve_private_nameserver_by_name( $args{name} ); | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 127 | 0 | croak $_; | |||||||||||||||||||||||||||
| 128 | 0 | }; | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub retrieve_private_nameserver_by_name { | ||||||||||||||||||||||||||
|
Subroutine
retrieve_private_nameserver_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 132 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 133 | 0 | my ( $name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 136 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 137 | method => 'CheckNSStatus', | ||||||||||||||||||||||||||||
| 138 | params => { | ||||||||||||||||||||||||||||
| 139 | CheckNSName => $name, | ||||||||||||||||||||||||||||
| 140 | }, | ||||||||||||||||||||||||||||
| 141 | }); | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 0 | ▶ | if( grep { $_ eq 'Error 545 - Name server does not exist' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 145 | 0 | croak 'Nameserver does not exist'; | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if( grep { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | 0 | $_ eq 'Error 531 - You are not authorized to receive information on this name server' | |||||||||||||||||||||||||||
| 149 | 0 | } @{ $response->{errors} } ) { | |||||||||||||||||||||||||||
| 150 | 0 | croak 'Nameserver not found in your account'; | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | ▶ | if( !exists $response->{CheckNsStatus} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 0 | croak 'Response did not contain private nameserver data'; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 0 | my $ip; | |||||||||||||||||||||||||||
| 161 | # Single IP Address | ||||||||||||||||||||||||||||
| 162 | 0 | ▶ | if( is_string( $response->{CheckNsStatus}{ipaddress} ) ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 163 | 0 | $ip = $response->{CheckNsStatus}{ipaddress}; | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | # Multiple IP Addresses, we only use the first one. | ||||||||||||||||||||||||||||
| 166 | ▶ | elsif( is_hash_ref( $response->{CheckNsStatus}{ipaddress} ) | |||||||||||||||||||||||||||
|
Condition0%0/3
is_hash_ref($response->{"CheckNsStatus"}{"ipaddress"}) and is_array_ref($response->{"CheckNsStatus"}{"ipaddress"}{"ipaddress"})
MC/DC0%0/2
is_hash_ref($response->{"CheckNsStatus"}{"ipaddress"}) and is_array_ref($response->{"CheckNsStatus"}{"ipaddress"}{"ipaddress"})
is_hash_ref($response->{"CheckNsStatus"}{"ipaddress"})
is_array_ref($response->{"CheckNsStatus"}{"ipaddress"}{"ipaddress"})
Truth table0%0/3
A and B
A= is_hash_ref($response->{"CheckNsStatus"}{"ipaddress"})B= is_array_ref($response->{"CheckNsStatus"}{"ipaddress"}{"ipaddress"})
| |||||||||||||||||||||||||||||
| 167 | && is_array_ref( $response->{CheckNsStatus}{ipaddress}{ipaddress} ) ) { | ||||||||||||||||||||||||||||
| 168 | 0 | $ip = $response->{CheckNsStatus}{ipaddress}{ipaddress}->[0]; | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | else { | ||||||||||||||||||||||||||||
| 171 | 0 | croak 'Unable to determine private nameserver ip address'; | |||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | return WWW::eNom::PrivateNameServer->new( | ||||||||||||||||||||||||||||
| 175 | name => $response->{CheckNsStatus}{name}, | ||||||||||||||||||||||||||||
| 176 | 0 | ip => $ip, | |||||||||||||||||||||||||||
| 177 | ); | ||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 180 | 0 | croak $_; | |||||||||||||||||||||||||||
| 181 | 0 | }; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub delete_private_nameserver { | ||||||||||||||||||||||||||
|
Subroutine
delete_private_nameserver: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 185 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 186 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 187 | \@_, | ||||||||||||||||||||||||||||
| 188 | domain_name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 189 | private_nameserver_name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 190 | ); | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 193 | # Prevent users from removing last private nameserver | ||||||||||||||||||||||||||||
| 194 | 0 | my $domain = $self->get_domain_by_name( $args{domain_name} ); | |||||||||||||||||||||||||||
| 195 | 0 | ▶ | if( scalar @{ $domain->ns } == 1 && $domain->ns->[0] eq $args{private_nameserver_name} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @{$domain->ns;} == 1 and $domain->ns->[0] eq $args{"private_nameserver_name"}
MC/DC0%0/2
scalar @{$domain->ns;} == 1 and $domain->ns->[0] eq $args{"private_nameserver_name"}
scalar @{$domain->ns;} == 1
$domain->ns->[0] eq $args{"private_nameserver_name"}
Truth table0%0/3
A and B
A= scalar @{$domain->ns;} == 1B= $domain->ns->[0] eq $args{"private_nameserver_name"}
| |||||||||||||||||||||||||||||
| 196 | 0 | croak 'Blocked deletion - Deleting this would leave this domain with no nameservers!'; | |||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | # Remove this private nameserver from the list of authoritative ones | ||||||||||||||||||||||||||||
| 200 | # and let update_nameservers_for_domain_name handle the deletion. | ||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if( grep { $_ eq $args{private_nameserver_name} } @{ $domain->ns } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 202 | return $self->update_nameservers_for_domain_name( | ||||||||||||||||||||||||||||
| 203 | domain_name => $domain->name, | ||||||||||||||||||||||||||||
| 204 | 0 | ns => [ grep { $_ ne $args{private_nameserver_name} } @{ $domain->ns } ] | |||||||||||||||||||||||||||
| 205 | ); | ||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | my $response = $self->submit({ | ||||||||||||||||||||||||||||
| 209 | method => 'DeleteNameServer', | ||||||||||||||||||||||||||||
| 210 | params => { | ||||||||||||||||||||||||||||
| 211 | NS => $args{private_nameserver_name}, | ||||||||||||||||||||||||||||
| 212 | }, | ||||||||||||||||||||||||||||
| 213 | 0 | }); | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if( grep { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | 0 | $_ eq 'Nameserver registration failed due to error 545: Object does not exist' | |||||||||||||||||||||||||||
| 218 | 0 | } @{ $response->{errors} } ) { | |||||||||||||||||||||||||||
| 219 | 0 | croak 'Nameserver does not exist'; | |||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 0 | ▶ | if( ( grep { $_ eq 'Domain ID not found.' } @{ $response->{errors} } ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
grep {$_ eq "Domain ID not found.";} @{$$response{"errors"};} or grep {$_ eq "Domain cannot be found.";} @{$$response{"errors"};}
MC/DC0%0/2
grep {$_ eq "Domain ID not found.";} @{$$response{"errors"};} or grep {$_ eq "Domain cannot be found.";} @{$$response{"errors"};}
grep {$_ eq "Domain ID not found.";} @{$$response{"errors"};}
grep {$_ eq "Domain cannot be found.";} @{$$response{"errors"};}
Truth table0%0/3
A or B
A= grep {$_ eq "Domain ID not found.";} @{$$response{"errors"};}B= grep {$_ eq "Domain cannot be found.";} @{$$response{"errors"};}
| |||||||||||||||||||||||||||||
| 223 | 0 | || ( grep { $_ eq 'Domain cannot be found.' } @{ $response->{errors} } ) ) { | |||||||||||||||||||||||||||
| 224 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 0 | return; | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 233 | 0 | croak $_; | |||||||||||||||||||||||||||
| 234 | 0 | }; | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 47 | 1; | |||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | __END__ | ||||||||||||||||||||||||||||