| 1 | package URI::_server; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 parent 'URI::_generic'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 47 | ▶ | use URI::Escape qw(uri_unescape); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 47 | our $VERSION = '5.40'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 921 | ▶ | sub _uric_escape { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_uric_escape: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 921 | my ($class, $str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 921 | ▶ | if ($str =~ m,^((?:$URI::scheme_re:)?)//([^/?\#]*)(.*)$,os) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 556 | my ($scheme, $host, $rest) = ($1, $2, $3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 556 | ▶ | my $ui = $host =~ s/(.*@)// ? $1 : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 556 | ▶ | my $port = $host =~ s/(:\d+)\z// ? $1 : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 556 | ▶ | if (_host_escape($host)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 5 | $str = "$scheme//$ui$host$port$rest"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 921 | return $class->SUPER::_uric_escape($str); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 594 | ▶ | sub _host_escape { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_host_escape: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 594 | return if URI::HAS_RESERVED_SQUARE_BRACKETS and $_[0] !~ /[^$URI::uric]/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 588 | ▶ | if !URI::HAS_RESERVED_SQUARE_BRACKETS and $_[0] !~ /[^$URI::uric4host]/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | require URI::_idna; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 6 | $_[0] = URI::_idna::encode($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 6 | ▶ | return 0 if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 5 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 15 | ▶ | sub as_iri { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_iri: called CC=5 SCAR=16.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 15 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 15 | my $str = $self->SUPER::as_iri; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 15 | ▶ | if ($str =~ /\bxn--/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 5 | ▶ | if ($str =~ m,^((?:$URI::scheme_re:)?)//([^/?\#]*)(.*)$,os) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 5 | my ($scheme, $host, $rest) = ($1, $2, $3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 5 | ▶ | my $ui = $host =~ s/(.*@)// ? $1 : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 5 | ▶ | my $port = $host =~ s/(:\d+)\z// ? $1 : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 5 | require URI::_idna; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 5 | $host = URI::_idna::decode($host); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 5 | $str = "$scheme//$ui$host$port$rest"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 15 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 181 | ▶ | sub userinfo { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
userinfo: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 181 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 181 | my $old = $self->authority; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 181 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 47 | my $new = $old; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 47 | ▶ | $new = "" unless defined $new; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 47 | $new =~ s/.*@//; # remove old stuff | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 47 | my $ui = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 47 | ▶ | if (defined $ui) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 43 | $ui =~ s/([^$URI::uric4user])/ URI::Escape::escape_char($1)/ego; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 43 | $new = "$ui\@$new"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 47 | $self->authority($new); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 181 | ▶ | return undef if !defined($old) || $old !~ /(.*)@/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $old and $old =~ /(.*)@/
MC/DC100%2/2
defined $old and $old =~ /(.*)@/
defined $old
$old =~ /(.*)@/
Truth table100%3/3
A and B
A= defined $oldB= $old =~ /(.*)@/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 143 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 529 | ▶ | sub host { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
host: called CC=13 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 529 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 529 | my $old = $self->authority; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 529 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 39 | my $tmp = $old; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 39 | ▶ | $tmp = "" unless defined $tmp; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 39 | ▶ | my $ui = ($tmp =~ /(.*@)/) ? $1 : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 39 | ▶ | my $port = ($tmp =~ /(:\d+)$/) ? $1 : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 39 | my $new = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 39 | ▶ | $new = "" unless defined $new; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 39 | ▶ | if (length $new) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 38 | $new =~ s/[@]/%40/g; # protect @ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 38 | ▶ | if ($new =~ /^[^:]*:\d*\z/ || $new =~ /]:\d*\z/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$new =~ /^[^:]*:\d*\z/ or $new =~ /]:\d*\z/
MC/DC100%2/2
$new =~ /^[^:]*:\d*\z/ or $new =~ /]:\d*\z/
$new =~ /^[^:]*:\d*\z/
$new =~ /]:\d*\z/
Truth table100%3/3
A or B
A= $new =~ /^[^:]*:\d*\z/B= $new =~ /]:\d*\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 4 | ▶ | $new =~ s/(:\d*)\z// || die "Assert"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 4 | $port = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 38 | ▶ | $new = "[$new]" if $new =~ /:/ && $new !~ /^\[/; # IPv6 address | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$new =~ /:/ and not $new =~ /^\[/
MC/DC100%2/2
$new =~ /:/ and not $new =~ /^\[/
$new =~ /:/
not $new =~ /^\[/
Truth table100%3/3
A and not(B)
A= $new =~ /:/B= not $new =~ /^\[/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 38 | _host_escape($new); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 39 | $self->authority("$ui$new$port"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 529 | ▶ | return undef unless defined $old; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 450 | $old =~ s/.*@//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 450 | $old =~ s/:\d*$//; # remove the port | |||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 450 | $old =~ s{^\[(.*)\]$}{$1}; # remove brackets around IPv6 (RFC 3986 3.2.2) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 450 | return uri_unescape($old); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 5 | ▶ | sub ihost { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ihost: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 5 | my $old = $self->host(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 5 | ▶ | if ($old =~ /(^|\.)xn--/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 3 | require URI::_idna; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 3 | $old = URI::_idna::decode($old); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 5 | return $old; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 567 | ▶ | sub _port { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_port: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 567 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 567 | my $old = $self->authority; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 567 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 61 | my $new = $old; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 61 | $new =~ s/:\d*$//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 61 | my $port = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 61 | ▶ | $new .= ":$port" if defined $port; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 61 | $self->authority($new); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 567 | ▶ | return $1 if defined($old) && $old =~ /:(\d*)$/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $old and $old =~ /:(\d*)$/
MC/DC100%2/2
defined $old and $old =~ /:(\d*)$/
defined $old
$old =~ /:(\d*)$/
Truth table100%3/3
A and B
A= defined $oldB= $old =~ /:(\d*)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 452 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 135 | ▶ | sub port { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
port: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 135 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 135 | my $port = $self->_port(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 135 | ▶ | $port = $self->default_port if !defined($port) || $port eq ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $port or $port eq ""
MC/DC100%2/2
not defined $port or $port eq ""
not defined $port
$port eq ""
Truth table100%3/3
not(A) or B
A= not defined $portB= $port eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 135 | $port; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 10 | ▶ | sub host_port { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
host_port: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 10 | my $old = $self->authority; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 10 | ▶ | $self->host(shift) if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 10 | ▶ | return undef unless defined $old; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 10 | $old =~ s/.*@//; # zap userinfo | |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 10 | $old =~ s/:$//; # empty port should be treated the same a no port | |||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 10 | ▶ | $old .= ":" . $self->port unless $old =~ /:\d+$/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 10 | $old; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub default_port {undef} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_port: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 422 | ▶ | sub canonical { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
canonical: called CC=14 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 422 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 422 | my $other = $self->SUPER::canonical; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 422 | ▶ | my $host = $other->host || ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$other->host || ''
MC/DC100%1/1
$other->host || ''
$other->host
Truth table100%2/2
A
A= $other->host
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 422 | my $port = $other->_port; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 422 | my $uc_host = $host =~ /[A-Z]/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 422 | ▶ | my $def_port | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
defined $port && ($port eq '' || $port == $self->default_port)
$port eq "" or $port == $self->default_port
MC/DC100%3/3
defined $port && ($port eq '' || $port == $self->default_port)
defined $port
$port eq ""
$port == $self->default_port
Truth table100%4/4
A && B or C
A= defined $portB= $port eq ""C= $port == $self->default_port
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | = defined($port) && ($port eq "" || $port == $self->default_port); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # strip leading zeros from non-default ports (e.g. 08080 -> 8080) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 422 | ▶ | my $norm_port | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition88%8/9
!$def_port && defined $port && $port ne '' && $port =~ /^0\d/
not $def_port and defined $port and $port ne ""
not $def_port and defined $port
MC/DC75%3/4
!$def_port && defined $port && $port ne '' && $port =~ /^0\d/
not $def_port
defined $port
$port ne ""
$port =~ /^0\d/
Truth table80%4/5
not(A) and B and C && D
A= not $def_portB= defined $portC= $port ne ""D= $port =~ /^0\d/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | = !$def_port && defined($port) && $port ne "" && $port =~ /^0\d/; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 422 | ▶ | if ($uc_host || $def_port || $norm_port) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$uc_host or $def_port or $norm_port
$uc_host or $def_port
MC/DC100%3/3
$uc_host or $def_port or $norm_port
$uc_host
$def_port
$norm_port
Truth table100%4/4
A or B or C
A= $uc_hostB= $def_portC= $norm_port
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 35 | ▶ | $other = $other->clone if $other == $self; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 35 | ▶ | $other->host(lc $host) if $uc_host; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 35 | ▶ | $other->port(undef) if $def_port; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 35 | ▶ | $other->_port(int($port)) if $norm_port; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 422 | $other; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 47 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||