Branch Coverage

blib/lib/Net/SIP/Util.pm
Criterion Covered Total %
branch 119 206 57.7


line true false branch
24 42 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() } }) { }
33 0 420 if @_ == 1
40 112 308 if not defined $args{'GetAddrInfoFlags'} and $args{'Domain'} || $args{'Family'}
45 420 0 if $args{'Proto'}
57 0 0 if @_ == 1
59 0 0 if exists $args{'Family'}
73 42 0 $mod6 ? :
74 42 0 if $mod6
114 0 744 if @_ != 2
116 0 744 unless defined $v
124 543 744 if ($v =~ /\G(.*?)([\\"<>$delim])/cg) { }
125 6 537 if ($2 eq '\\') { }
62 475 elsif ($2 eq '"') { }
29 446 elsif ($2 eq '<') { }
29 417 elsif ($2 eq '>') { }
417 0 elsif ($2 eq $delim) { }
130 62 0 unless $bracket
133 29 0 unless $bracket or $quoted
136 29 0 if $bracket and not $quoted
139 380 37 if (not $quoted || $bracket) { }
157 8 736 if ($delim eq ',')
165 377 11 if (defined $value)
196 67 0 if (defined $v)
199 0 67 if $v =~ /\s|$delim/
219 26 280 if $uri =~ /<([^>]+)>\s*$/
221 306 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) { }
234 306 0 wantarray ? :
253 17 114 $user ? :
0 131 ref $domain ? :
259 46 85 $param && %$param ? :
276 0 174 unless my($domain, undef, $proto, $param) = sip_uri2parts(shift())
280 18 147 $param->{'transport'} ? :
9 165 $proto && $proto eq 'sips' ? :
297 0 0 ref $_[0] ? :
299 0 0 $proto eq 'udp' ? :
0 0 $proto eq 'tcp' ? :
0 0 $proto eq 'tls' ? :
0 0 !defined($proto) ? :
317 1 8 if $uri1 eq $uri2
320 0 6 $p1 eq 'sips' ? :
2 6 $d1 =~ s/:(\d+)$|\[(\d+)\]$// ? :
322 0 6 $p2 eq 'sips' ? :
2 6 $d2 =~ s/:(\d+)$|\[(\d+)\]$// ? :
345 0 5 unless $fam
346 0 5 @src ? :
347 0 5 $src ? :
0 5 unless my $sock = INETSOCK('Proto', 'udp', 'Family', $fam, 'PeerAddr', $addr, 'PeerPort', $port || 5060, $src ? ('LocalAddr', $src) : ())
355 5 0 wantarray ? :
385 0 5 $proto eq 'tls' ? :
386 0 8 if $Net::SIP::Util::DEBUG
388 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)
396 0 5 if $Net::SIP::Util::DEBUG
397 2 3 unless wantarray
421 48 0 if (not $min) { }
436 48 48 if @socks == $range
450 0 48 if @socks != $range
471 3896 9852 if (UNIVERSAL::isa($cb, 'CODE')) { }
4 9848 elsif (my $sub = UNIVERSAL::can($cb, 'run')) { }
9674 174 elsif (UNIVERSAL::isa($cb, 'ARRAY')) { }
2 172 elsif (UNIVERSAL::isa($cb, 'Regexp')) { }
80 92 elsif (UNIVERSAL::isa($cb, 'SCALAR') or UNIVERSAL::isa($cb, 'REF')) { }
0 92 elsif ($cb) { }
482 0 2 unless @more_args
484 2 0 if /$cb/
489 80 0 @more_args ? :
511 237 175 if ($addr =~ /:[^:\s]*(:)?/) { }
512 237 0 if (not $1) { }
0 0 elsif ($addr =~ /^\[(?:(.*:.*)|([^:]*))\](?::(\w+))?\z/) { }
518 0 0 $1 ? :
535 359 53 if ($addr = inet_pton($family, $host)) { }
8 45 elsif ($opaque) { }
45 0 elsif ($host =~ /^[a-z\d\-\_]+(?:\.[a-z\d\-\_]+)*\.?\z/) { }
537 0 359 $opaque ? :
552 404 8 unless $opaque
553 412 0 if wantarray
580 226 227 if (ref $_[0]) { }
585 0 141 if (exists $hash->{'use_host'} and $hash->{'use_host'} and $hash->{'host'} and $fam and $hash->{'host'} ne $hash->{'addr'})
592 6 220 if (exists $hash->{'default_port'} and $port == $hash->{'default_port'})
599 1 5 unless $port or $ipv6_brackets
602 0 452 if $fam and $fam != 2
603 5 447 unless $port
619 121 86 if (ref $_[0]) { }
626 0 86 $addr =~ /:/ ? :
627 207 0 if ($fam == 2) { }
649 0 371 length $sockaddr >= 24 ? :
650 0 371 if $fam != 2 and !1
651 371 0 $fam == 2 ? :
655 20 351 if wantarray
673 0 0 length $sockaddr >= 24 ? :
674 0 0 if ($fam == 2) { }
692 0 0 $ip =~ /:/ ? :
693 64 0 if ($family == 2) { }
712 0 44 $ip =~ /:/ ? :
725 0 0 if not $family and !1
726 0 0 $family ? :
728 0 0 if $err or not @result
729 0 0 unless wantarray
731 0 0 wantarray ? :
749 0 0 inet_pton(10, $_[0]) ? :
10 0 inet_pton(2, $_[0]) ? :