Branch Coverage

blib/lib/Net/SIP/Util.pm
Criterion Covered Total %
branch 118 204 57.8


line true false branch
24 44 0 if (eval { do { require IO::Socket::IP; 'IO::Socket::IP'->VERSION(0.31); 'Socket'->import('AF_INET6'); &AF_INET6() } }) { }
0 0 elsif (eval { do { require IO::Socket::INET6; 'IO::Socket::INET6'->VERSION(2.62); 'Socket'->import('AF_INET6'); &AF_INET6() } }) { }
32 0 432 if @_ == 1
39 120 312 if not defined $args{'GetAddrInfoFlags'} and $args{'Domain'} || $args{'Family'}
51 0 0 if @_ == 1
53 0 0 if exists $args{'Family'}
67 44 0 $mod6 ? :
68 44 0 if $mod6
108 0 769 if @_ != 2
110 0 769 unless defined $v
118 556 769 if ($v =~ /\G(.*?)([\\"<>$delim])/cg) { }
119 6 550 if ($2 eq '\\') { }
62 488 elsif ($2 eq '"') { }
29 459 elsif ($2 eq '<') { }
29 430 elsif ($2 eq '>') { }
430 0 elsif ($2 eq $delim) { }
124 62 0 unless $bracket
127 29 0 unless $bracket or $quoted
130 29 0 if $bracket and not $quoted
133 393 37 if (not $quoted || $bracket) { }
151 8 761 if ($delim eq ',')
159 390 11 if (defined $value)
190 69 0 if (defined $v)
193 0 69 if $v =~ /\s|$delim/
213 26 288 if $uri =~ /<([^>]+)>\s*$/
215 314 0 if ($data =~ /^ (?: (sips?) : )? (?: ([^\s\@]*) \@ )? ( \[ [^\]\s]+ \] ( : \w+)? # [ipv46_or_host]:port | [^:\s]+ ( : \w+)? # ipv4_or_host:port | (?:[a-f\d]*:){2}[a-f\d\.:]* # ipv6 ) $/xi) { }
228 314 0 wantarray ? :
247 19 114 $user ? :
0 133 ref $domain ? :
253 46 87 $param && %$param ? :
270 0 178 unless my($domain, undef, $proto, $param) = sip_uri2parts(shift())
274 18 151 $param->{'transport'} ? :
9 169 $proto && $proto eq 'sips' ? :
291 0 0 ref $_[0] ? :
293 0 0 $proto eq 'udp' ? :
0 0 $proto eq 'tcp' ? :
0 0 $proto eq 'tls' ? :
0 0 !defined($proto) ? :
311 1 8 if $uri1 eq $uri2
314 0 6 $p1 eq 'sips' ? :
2 6 $d1 =~ s/:(\d+)$|\[(\d+)\]$// ? :
316 0 6 $p2 eq 'sips' ? :
2 6 $d2 =~ s/:(\d+)$|\[(\d+)\]$// ? :
339 0 5 unless $fam
340 0 5 @src ? :
341 0 5 $src ? :
0 5 unless my $sock = INETSOCK('Proto', 'udp', 'Family', $fam, 'PeerAddr', $addr, 'PeerPort', $port || 5060, $src ? ('LocalAddr', $src) : ())
349 5 0 wantarray ? :
379 0 5 $proto eq 'tls' ? :
380 0 8 if $Net::SIP::Util::DEBUG
382 8 0 $p ? :
0 8 $proto eq 'tls' ? :
3 5 unless my $sock = INETSOCK('Family', $fam, 'LocalAddr', $laddr, $p ? ('LocalPort', $p) : (), 'Proto', $proto eq 'tls' ? 'tcp' : $proto)
390 0 5 if $Net::SIP::Util::DEBUG
391 2 3 unless wantarray
415 52 0 if (not $min) { }
430 52 52 if @socks == $range
444 0 52 if @socks != $range
465 3953 10135 if (UNIVERSAL::isa($cb, 'CODE')) { }
4 10131 elsif (my $sub = UNIVERSAL::can($cb, 'run')) { }
9954 177 elsif (UNIVERSAL::isa($cb, 'ARRAY')) { }
2 175 elsif (UNIVERSAL::isa($cb, 'Regexp')) { }
82 93 elsif (UNIVERSAL::isa($cb, 'SCALAR') or UNIVERSAL::isa($cb, 'REF')) { }
0 93 elsif ($cb) { }
476 0 2 unless @more_args
478 2 0 if /$cb/
483 82 0 @more_args ? :
505 246 183 if ($addr =~ /:[^:\s]*(:)?/) { }
506 246 0 if (not $1) { }
0 0 elsif ($addr =~ /^\[(?:(.*:.*)|([^:]*))\](?::(\w+))?\z/) { }
512 0 0 $1 ? :
529 376 53 if ($addr = inet_pton($family, $host)) { }
8 45 elsif ($opaque) { }
45 0 elsif ($host =~ /^[a-z\d\-\_]+(?:\.[a-z\d\-\_]+)*\.?\z/) { }
531 0 376 $opaque ? :
546 421 8 unless $opaque
547 429 0 if wantarray
574 232 231 if (ref $_[0]) { }
579 0 143 if (exists $hash->{'use_host'} and $hash->{'use_host'} and $hash->{'host'} and $fam and $hash->{'host'} ne $hash->{'addr'})
586 6 226 if (exists $hash->{'default_port'} and $port == $hash->{'default_port'})
593 1 5 unless $port or $ipv6_brackets
596 0 462 if $fam and $fam != 2
597 5 457 unless $port
613 127 94 if (ref $_[0]) { }
620 0 94 $addr =~ /:/ ? :
621 221 0 if ($fam == 2) { }
643 0 378 length $sockaddr >= 24 ? :
644 0 378 if $fam != 2 and !1
645 378 0 $fam == 2 ? :
649 20 358 if wantarray
667 0 0 length $sockaddr >= 24 ? :
668 0 0 if ($fam == 2) { }
686 0 0 $ip =~ /:/ ? :
687 68 0 if ($family == 2) { }
706 0 48 $ip =~ /:/ ? :
719 0 0 if not $family and !1
720 0 0 $family ? :
722 0 0 if $err or not @result
723 0 0 unless wantarray
725 0 0 wantarray ? :
743 0 0 inet_pton(10, $_[0]) ? :
10 0 inet_pton(2, $_[0]) ? :