Branch Coverage

blib/lib/XML/Stream.pm
Criterion Covered Total %
branch 142 452 31.4


line true false branch
140 0 14 if $@
195 7 0 if exists $args{'style'}
197 0 7 if ($$self{'DATASTYLE'} eq 'tree' and not defined $XML::Stream::Tree::LOADED or $$self{'DATASTYLE'} eq 'node' and not defined $XML::Stream::Node::LOADED)
237 7 0 if $$self{'CB'}
277 0 0 if exists $$self{'SIDS'}{$serverid}
293 0 0 if ($$self{'SIDS'}{$serverid}{'namespace'} eq '')
303 0 0 if ($$self{'SIDS'}{$serverid}{'hostname'} eq '')
308 0 0 if ($$self{'SIDS'}{$serverid}{'port'} eq '')
313 0 0 if ($$self{'SIDS'}{$serverid}{'myhostname'} eq '')
429 0 0 if ($$root{'xmlns'} ne $$self{'SIDS'}{$serverid}{'namespace'})
444 0 0 exists $$self{'SIDS'}{$serverid}{'from'} ? :
585 3 0 exists $$self{'SIDS'}{'newconnection'}{'timeout'} ? :
592 0 3 if (exists $$self{'SIDS'}{'newconnection'}{'srv'})
595 0 0 if ($XML::Stream::NETDNS) { }
600 0 0 if ($query) { }
619 0 3 unless exists $$self{'SIDS'}{'newconnection'}{'connectiontype'}
624 0 3 if ($$self{'SIDS'}{'newconnection'}{'namespace'} eq '')
631 2 1 if (1 == $$self{'SIDS'}{'newconnection'}{'ssl'} or 1 == $$self{'SIDS'}{'newconnection'}{'_tls'})
638 0 2 if (0 != $$self{'SIDS'}{'newconnection'}{'ssl_verify'})
640 0 0 unless -e -r $$self{'SIDS'}{'newconnection'}{'ssl_ca_path'}
643 0 0 if (-f $$self{'SIDS'}{'newconnection'}{'ssl_ca_path'}) { }
659 3 0 if ($$self{'SIDS'}{'newconnection'}{'connectiontype'} eq 'tcpip')
665 0 3 if ($$self{'SIDS'}{'newconnection'}{'hostname'} eq '')
670 0 3 if ($$self{'SIDS'}{'newconnection'}{'port'} eq '')
675 0 3 if ($$self{'SIDS'}{'newconnection'}{'myhostname'} eq '')
684 3 0 $timeout ne '' ? :
690 0 3 unless $$self{'SIDS'}{'newconnection'}{'sock'}
692 1 2 if ($$self{'SIDS'}{'newconnection'}{'ssl'} == 1)
703 1 0 if $$self{'SIDS'}{'newconnection'}{'sock'}
705 0 3 unless $$self{'SIDS'}{'newconnection'}{'sock'}
711 0 3 if ($$self{'SIDS'}{'newconnection'}{'connectiontype'} eq 'stdinout')
720 0 3 if ($$self{'SIDS'}{'newconnection'}{'connectiontype'} eq 'http')
726 0 0 if ($$self{'SIDS'}{'newconnection'}{'hostname'} eq '')
731 0 0 if ($$self{'SIDS'}{'newconnection'}{'port'} eq '')
736 0 0 if ($$self{'SIDS'}{'newconnection'}{'myhostname'} eq '')
741 0 0 unless (defined $XML::Stream::PAC)
744 0 0 if ($@) { }
755 0 0 if ($XML::Stream::PAC eq '0') { }
756 0 0 if (exists $ENV{'http_proxy'})
763 0 0 if (exists $ENV{'https_proxy'})
774 0 0 if ($proxy ne 'DIRECT')
781 0 0 if ($proxy ne 'DIRECT')
787 0 0 if exists $$self{'SIDS'}{'newconnection'}{'httpproxyhostname'} and defined $$self{'SIDS'}{'newconnection'}{'httpproxyhostname'} and exists $$self{'SIDS'}{'newconnection'}{'httpproxyport'} and defined $$self{'SIDS'}{'newconnection'}{'httpproxyport'}
792 0 0 if exists $$self{'SIDS'}{'newconnection'}{'httpsproxyhostname'} and defined $$self{'SIDS'}{'newconnection'}{'httpsproxyhostname'} and exists $$self{'SIDS'}{'newconnection'}{'httpsproxyport'} and defined $$self{'SIDS'}{'newconnection'}{'httpsproxyport'}
809 0 0 unless (exists $$self{'SIDS'}{'newconnection'}{'httpproxyhostname'} or exists $$self{'SIDS'}{'newconnection'}{'httpsproxyhostname'})
816 0 0 $timeout ne '' ? :
839 0 0 if (not $connected and exists $$self{'SIDS'}{'newconnection'}{'httpproxyhostname'} and $$self{'SIDS'}{'newconnection'}{'ssl'} == 0)
845 0 0 $timeout ne '' ? :
853 0 0 if ($connected)
861 0 0 unless $code =~ /2\d\d/
868 0 0 if (not $connected and exists $$self{'SIDS'}{'newconnection'}{'httpproxyhostname'} and $$self{'SIDS'}{'newconnection'}{'ssl'} == 0)
874 0 0 $timeout ne '' ? :
882 0 0 if ($connected)
889 0 0 unless $code =~ /2\d\d/
897 0 0 if (not $connected and exists $$self{'SIDS'}{'newconnection'}{'httpsproxyhostname'})
907 0 0 if ($connected)
914 0 0 unless $code =~ /2\d\d/
922 0 0 unless ($connected)
929 0 0 unless $$self{'SIDS'}{'newconnection'}{'sock'}
933 0 0 if ($$self{'SIDS'}{'newconnection'}{'ssl'} == 1 and ref $$self{'SIDS'}{'newconnection'}{'sock'} eq 'IO::Socket::INET')
944 0 0 if $$self{'SIDS'}{'newconnection'}{'sock'}
946 0 0 unless $$self{'SIDS'}{'newconnection'}{'sock'}
972 0 3 unless defined $timeout
981 3 0 if ($$self{'SIDS'}{$currsid}{'connectiontype'} eq 'tcpip' or $$self{'SIDS'}{$currsid}{'connectiontype'} eq 'http')
984 2 1 unless exists $$self{'SIDS'}{$currsid}{'to'}
987 1 2 if exists $$self{'SIDS'}{$currsid}{'to'}
990 3 0 if not exists $$self{'SIDS'}{$currsid}{'from'} and $$self{'SIDS'}{$currsid}{'myhostname'} ne ''
995 0 3 if exists $$self{'SIDS'}{$currsid}{'from'}
998 0 3 if exists $$self{'SIDS'}{$currsid}{'id'} and $$self{'SIDS'}{$currsid}{'id'} ne ''
1033 3 0 if ($$self{'SIDS'}{$currsid}{'connectiontype'} eq 'tcpip' or $$self{'SIDS'}{$currsid}{'connectiontype'} eq 'http')
1040 0 3 if ($$self{'SIDS'}{$currsid}{'connectiontype'} eq 'stdinout')
1053 0 3 unless $self->Send($currsid, $stream)
1060 0 3 $timeout eq '' ? :
1064 0 3 $timeEnd eq '' || $timeEnd - $now > 10 ? :
1068 3 0 if ($$self{'SIDS'}{$currsid}{'select'}->can_read($wait)) { }
1070 0 3 unless defined($buff = $self->Read($currsid))
1072 0 3 unless $$self{'SIDS'}{$currsid}{'status'} == 0
1073 0 3 unless $self->ParseStream($currsid, $buff) == 1
1077 0 0 if ($timeout ne '')
1079 0 0 if (time >= $timeEnd)
1087 0 3 if $$self{'SIDS'}{$currsid}{'select'}->has_exception(0)
1089 0 3 if $$self{'SIDS'}{$currsid}{'status'} != 1
1101 3 0 if ($$self{'SIDS'}{$sid}{'connectiontype'} eq 'tcpip' or $$self{'SIDS'}{$sid}{'connectiontype'} eq 'http')
1107 0 3 if ($$self{'SIDS'}{$sid}{'connectiontype'} eq 'stdinout')
1113 3 0 unless $currsid eq $sid
1116 3 0 if (exists $self->GetRoot($sid)->{'version'} and $self->GetRoot($sid)->{'version'} ne '')
1182 0 4 if ($^O =~ /mswin32/i) { }
1205 4 0 if ($$self{'SIDS'}{'newconnection'}{'select'}->can_read(0))
1207 0 4 unless defined($buff = $self->Read('newconnection'))
1209 0 4 unless $$self{'SIDS'}{'newconnection'}{'status'} == 0
1210 0 4 unless $self->ParseStream('newconnection', $buff) == 1
1213 0 4 if $$self{'SIDS'}{'newconnection'}{'select'}->has_exception(0) and $$self{'SIDS'}{'newconnection'}{'sock'}->error
1216 0 4 if $$self{'SIDS'}{'newconnection'}{'status'} != 1
1264 0 0 if $$self{'SIDS'}{$sid}{'connectiontype'} eq 'tcpip' or $$self{'SIDS'}{$sid}{'connectiontype'} eq 'http'
1356 0 11 unless defined $stream
1362 0 11 if (exists $$self{'SIDS'}{$sid}{'streamerror'}{'type'})
1401 4 0 unless defined $timeout
1417 4 4 if $sid eq 'default'
1427 4 0 $timeout eq '' ? :
1433 4 0 $timeEnd eq '' || $timeEnd - $now > 10 ? :
1442 0 4 unless $$self{'SIDS'}{$$self{'SOCKETS'}{$connection}}{'status'} == 1 or exists $$self{'SIDS'}{$$self{'SOCKETS'}{$connection}}{'activitytimeout'}
1446 0 4 if (exists $$self{'SIDS'}{'server'})
1450 0 0 if (exists $$self{'SIDS'}{$serverid}{'sock'} and $connection == $$self{'SIDS'}{$serverid}{'sock'})
1460 4 0 if ($processit == 1)
1468 4 0 unless defined($buff = $self->Read($sid))
1470 4 0 unless defined $buff
1472 4 0 unless $$self{'SIDS'}{$sid}{'status'} == 1
1474 0 4 unless $self->ParseStream($sid, $buff) == 1
1479 0 4 if ($timeout ne '')
1481 0 0 if (time >= $timeEnd)
1490 0 4 if (exists $$self{'CB'}{'update'})
1496 4 0 if $$self{'SELECT'}->can_read(0)
1504 4 4 if $sid eq 'default'
1505 0 4 if $sid =~ /^server/
1506 4 0 if $status{$sid} == -1
1507 0 0 if (time - $$self{'SIDS'}{$sid}{'keepalive'} > 10)
1510 0 0 unless defined $self->Send($sid, ' ')
1512 0 0 unless $$self{'SIDS'}{$sid}{'status'} == 1
1513 0 0 if ($status{$sid} == -1)
1527 4 4 if $sid eq 'default'
1528 0 4 if $sid =~ /^server/
1530 0 4 if (exists $$self{'SIDS'}{$sid}{'activitytimeout'}) { }
1539 0 4 if exists $$self{'SIDS'}{$sid}{'activitytimeout'} and defined $self->GetRoot($sid)
1542 0 0 if exists $$self{'SIDS'}{$sid}{'activitytimeout'} and time - $$self{'SIDS'}{$sid}{'activitytimeout'} > 10 and $$self{'SIDS'}{$sid}{'status'} != 1
1555 4 0 if ($status{$sid} == -1)
1583 0 4 if $status{$sid} == 1 and $#{$$self{'SIDS'}{$sid}{'nodes'};} > -1
1612 0 11 if $$self{'SIDS'}{$sid}{'status'} == -1
1614 0 11 unless (defined $$self{'SIDS'}{$sid}{'sock'})
1623 8 0 if $$self{'SIDS'}{$sid}{'connectiontype'} eq 'tcpip' or $$self{'SIDS'}{$sid}{'connectiontype'} eq 'http' or $$self{'SIDS'}{$sid}{'connectiontype'} eq 'file'
1627 0 11 if $$self{'SIDS'}{$sid}{'connectiontype'} eq 'stdinout'
1630 0 11 if $$self{'SIDS'}{$sid}{'connectiontype'} eq 'http'
1632 11 0 if defined $status
1633 0 11 unless defined $status
1634 7 0 unless $buff eq '' or not defined $status or $status == 0
1636 7 4 if (defined $status and $status != 0)
1673 0 3 if $$self{'SIDS'}{$sid}{'status'} == -1
1675 0 3 if (not defined $$self{'SIDS'}{$sid}{'sock'}) { }
1689 3 0 if ($$self{'SIDS'}{$sid}{'select'}->can_write(0)) { }
1702 0 3 unless (defined $$self{'SENDWRITTEN'})
1722 0 3 if $$self{'SIDS'}{$sid}{'select'}->has_exception(0)
1766 3 0 if ($#sasl > -1)
1768 3 0 if (&XPath($sasl[0], 'name()') eq 'mechanisms')
1779 2 1 if ($#tls > -1)
1781 2 0 if (&XPath($tls[0], 'name()') eq 'starttls')
1785 2 0 if ($#required > -1)
1796 0 3 if ($#bind > -1)
1805 0 3 if ($#session > -1)
1829 0 0 unless exists $$self{'SIDS'}{$sid}{'streamfeatures'}{$feature}
1882 0 0 if ($tag eq 'failure')
1887 0 0 if ($tag eq 'proceed')
1909 0 0 unless defined $timeout
1910 0 0 if $timeout eq ''
1920 0 0 unless ($self->TLSClientSecure($sid))
1966 0 0 unless ($self->LoadSSL)
1979 0 0 if $$self{'SIDS'}{$sid}{'sock'}
2117 0 0 if ($tag eq 'challenge')
2122 0 0 if ($tag eq 'failure')
2127 0 0 if ($tag eq 'success')
2162 0 0 unless ($challenge =~ /rspauth\=/)
2243 0 0 unless defined $mechanisms
2248 0 0 $$self{'SIDS'}{$sid}{'to'} ? :
2440 0 3 if $type eq 'error'
2441 3 0 if $type eq 'features'
2464 3 4 if ($$self{'SIDS'}{$sid}{'connectiontype'} ne 'file') { }
2471 3 0 $tag eq 'stream:stream' && exists $att{'xmlns'} && $att{'xmlns'} eq $$self{'SIDS'}{$$self{'SIDS'}{$sid}{'serverid'}}{'namespace'} ? :
2499 3 14 if ($key =~ /^xmlns\:(.+?)$/)
2513 0 7 if ($tag eq $stream_prefix . ':error')
2515 0 0 if $$self{'DATASTYLE'} eq 'tree'
2517 0 0 if $$self{'DATASTYLE'} eq 'node'
2546 0 0 if (ref $node[0] eq 'XML::Stream::Node') { }
2590 0 0 unless defined $sid
2593 0 0 exists $$self{'SIDS'}{$sid}{'errorcode'} && ref $$self{'SIDS'}{$sid}{'errorcode'} eq 'HASH' ? :
2636 0 0 if (not exists $$self{'SIDS'}{$sid}{'root'}{'version'} or $$self{'SIDS'}{$sid}{'root'}{'version'} eq '' or $$self{'SIDS'}{$sid}{'root'}{'version'} < 1)
2655 0 0 if (&XPath($error, 'name()') eq 'text') { }
2691 0 0 if (exists $$root{'version'} and $$root{'version'} ne '') { }
2694 0 0 if (defined $text)
2732 0 0 unless defined $ignoreActivity
2768 0 6 if exists $$self{'SIDS'}{$sid}{'ignoreActivity'} and $$self{'SIDS'}{$sid}{'ignoreActivity'} == 1
2815 0 0 if ref $_[1] eq 'XML::Stream::Node'
2816 0 0 if ref $_[1] eq 'ARRAY'
2878 976 873 if ref $_[1] eq 'XML::Stream::Node'
2879 873 0 if ref $_[1] eq 'ARRAY'
2903 48 75 if ($result->check)
2906 2 46 if scalar keys %attribs > 0
2909 27 19 unless $#values > -1
2910 38 8 if wantarray
2970 59 59 if ref $_[0] eq 'XML::Stream::Node'
2971 59 0 if ref $_[0] eq 'ARRAY'
3007 0 0 unless defined $indent
3011 0 0 if (ref $hash eq 'ARRAY') { }
3020 0 0 if (ref $hash eq 'HASH' and scalar keys %{$hash;} == 0) { }
3026 0 0 if (ref $hash eq '') { }
3028 0 0 if ($hash eq '') { }
3068 269 0 if (defined $data)
3095 0 0 if (defined $data)
3121 34 17 if ref $_[0] eq 'XML::Stream::Node'
3122 17 0 if ref $_[0] eq 'ARRAY'
3123 0 0 if ref $_[1] eq 'ARRAY'
3230 0 12 unless exists $$self{'SIDS'}{$sid}{'root'}
3268 0 1 if (defined $XML::Stream::SSL and $XML::Stream::SSL == 1)
3274 0 1 if (defined $XML::Stream::SSL and $XML::Stream::SSL == 0)
3282 0 1 if ($@)
3306 0 0 if $sid eq 'default'
3307 0 0 if $sid =~ /^server/
3309 0 0 if $$self{'SIDS'}{$sid}{'hostname'} eq $hostname
3331 0 4 if exists $$self{'CB'}{'sid'} and defined $$self{'CB'}{'sid'}
3365 0 11 if ($tag eq 'node' and not defined $func) { }
3394 3 0 if exists $args{'to'}
3395 3 0 if exists $args{'from'}
3396 3 0 if exists $args{'xmllang'}
3416 2167 0 if $_[1] > $_[0]{'DEBUGLEVEL'}
3419 0 0 if $$self{'DEBUGFILE'} eq ''
3421 0 0 if ($$self{'DEBUGTIME'} == 1)
3444 0 0 if ($^O eq 'MSWin32')
3446 0 0 unless ioctl $socket, 2147772030, 1
3454 0 0 unless my $flags = fcntl($socket, 3, 0)
3456 0 0 unless fcntl $socket, 4, $flags | 2048
3490 0 0 if (ref $data eq 'HASH') { }
3495 0 0 if (ref $$data{$key} eq '') { }
3497 0 0 defined $$data{$key} ? :
3502 0 0 if (ref($$data{$key}) =~ /Net::Jabber/) { }
3516 0 0 if (ref $data eq 'ARRAY') { }
3521 0 0 if (ref $$data[$index] eq '') { }
3527 0 0 if (ref($$data[$index]) =~ /Net::Jabber/) { }
3541 0 0 if (ref $data eq 'REF') { }
3547 0 0 if (ref $data eq '') { }