Branch Coverage

blib/lib/Net/MitM.pm
Criterion Covered Total %
branch 137 212 64.6


line true false branch
134 0 167 unless $$this{'remote_ip_address'} = shift()
135 0 167 unless $$this{'remote_port_num'} = shift()
174 0 1701 unless my $key = shift()
176 1658 43 if (defined $value)
321 16 177 unless ($$allowed{$key})
322 0 16 unless defined $$self{'verbose'} and $$self{'verbose'} <= 0
325 16 161 unless ($$options{$key} =~ /$$allowed{$key}/)
326 0 16 unless $$self{'verbose'} <= 0
338 129 0 if $options{'callback_behaviour'}
380 126 2 if $options{'callback_behaviour'}
424 2 176 if (defined $interval and $interval == 0)
457 5 0 if ($parallel)
490 0 0 defined $level ? :
491 0 0 $parallel ? :
519 18 0 if (defined $new_log_file)
520 0 18 if (not $new_log_file) { }
521 0 0 if ($$this{'LOGFILE'})
524 0 0 if $$this{'verbose'}
528 18 0 if (open $LOGFILE, ">>$new_log_file") { }
535 0 0 if $$this{'verbose'}
537 18 0 if $$this{'verbose'} and $$this{'log_file'}
571 13 150 if ($$this{'parent'}) { }
687 0 35 unless $$this{'local_port_num'} = shift()
688 0 35 unless $$this{'server_callback'} = shift()
728 0 306 unless $$this{'remote_ip_address'} = shift()
729 0 306 unless $$this{'remote_port_num'} = shift()
760 368 2263 if $$this{'LOGFILE'}
788 0 1294 unless $$this{'verbose'}
789 0 1294 unless $$this{'name'}
790 543 751 if ($_[0] =~ /^[<>]{3}$/) { }
829 295 489 if ($callback)
830 0 295 if $$this{'verbose'} > 1
835 25 270 if ($callback_behaviour eq 'modify' or $callback_behaviour ne 'readonly' and defined $new_msg)
848 0 543 if ($$this{'verbose'} > 1) { }
863 2 467 unless (defined $msg)
864 0 2 if $$this{'verbose'} > 1
868 0 467 unless $$this{'SERVER'}
869 0 467 unless print {$$this{'SERVER'};} $msg
906 0 76 unless (defined $msg)
907 0 0 if $$this{'verbose'} > 1
939 0 461 unless sysread $$this{'SERVER'}, $msg, 100000
940 0 461 if (length $msg == 0)
1012 0 493 unless my $proto = getprotobyname $protocol
1013 0 493 $protocol eq 'udp' ? :
1015 0 493 unless socket $$this{$socket}, 2, $sock, $proto
1021 165 324 if $$this{'SERVER'}
1023 0 324 unless $$this{'remote_ip_address'}
1024 0 324 unless my $remote_ip_aton = inet_aton($$this{'remote_ip_address'})
1025 0 324 unless my $remote_port_address = sockaddr_in($$this{'remote_port_num'}, $remote_ip_aton)
1027 1 323 unless my $connect = connect($$this{'SERVER'}, $remote_port_address)
1074 0 122 if $$this{'defrag_delay'}
1079 44 78 if (length $msg == 0)
1085 35 43 if ($$this{'SERVER'}) { }
43 0 elsif ($$this{'server_callback'}) { }
1128 0 33 if $$this{'defrag_delay'}
1131 0 33 unless (defined $msg)
1141 0 43 unless my $this = shift()
1142 0 43 unless my $child = shift()
1144 43 0 if ($child == $$this{'children'}[$i])
1145 0 43 if $$this{'verbose'} > 1
1161 23 2 if ($$this{'timer_interval'} and $$this{'timer_callback'})
1170 219 7 if ($$this{'LISTEN'})
1171 0 219 unless fileno $$this{'LISTEN'}
1175 298 219 if $$each{'CLIENT'}
1176 89 428 if $$each{'SERVER'}
1181 215 11 if ($$this{'timer_interval'}) { }
1182 18 197 if (time > $target_time)
1184 10 7 if ($resp) { }
1193 0 207 if $delay < 0
1194 0 207 if $$this{'verbose'} > 1
1199 0 218 if ($status == -1)
1202 45 173 if ($$this{'LISTEN'} and vec $rout, fileno $$this{'LISTEN'}, 1)
1204 43 1 if $child
1208 0 368 if not $$each{'CLIENT'} and $each != $this
1209 122 246 if ($$each{'CLIENT'} and vec $rout, fileno $$each{'CLIENT'}, 1)
1211 44 78 if (not $$each{'CLIENT'}) { }
1214 1 43 if ($each == $this) { }
1226 15 28 if ($$this{'stop_when_idle'} and not @{$$this{'children'};})
1230 0 28 $$this{'stop_when_idle'} ? :
1234 0 78 if $$this{'verbose'} > 1
1237 33 291 if ($$each{'SERVER'} and vec $rout, fileno $$each{'SERVER'}, 1)
1239 0 33 unless ($$each{'SERVER'})
1241 0 0 if ($each == $this) { }
1246 0 0 if ($$this{'stop_when_idle'} and not @{$$this{'children'};})
1318 0 0 if (defined $mydate)
1347 23 169 if $$this{'LISTEN'}
1348 5 164 $$this{'parallel'} ? :
1350 0 169 unless bind $$this{'LISTEN'}, sockaddr_in($$this{'local_port_num'}, "\000\000\000\000")
1351 0 169 unless CORE::listen $$this{'LISTEN'}, 1
1361 0 45 unless my $client_paddr = accept($$this{'CLIENT'}, $LISTEN)
1366 18 27 if ($$this{'remote_ip_address'})
1367 0 18 unless $this->connect_to_server
1379 252 542 if ($key =~ /^(LISTEN|children|connections|timer_interval|timer_callback|is_running|stop_when_idle)$/) { }
434 108 elsif ($key =~ /^(parallel|log_file|verbose|mydate|(client_to_server|server_to_client|server)_callback(_behaviour)?|(local|remote)_(port_num|ip_address)|protocol)$/) { }
63 45 elsif ($key =~ /^(name)$/) { }
45 0 elsif ($key eq 'LOGFILE') { }
1393 0 63 unless $all_good
1402 0 45 unless $$child{'CLIENT'}
1405 43 2 unless ($$this{'parallel'})
1409 0 2 if (not defined $pid) { }
1 1 elsif (not $pid) { }
1415 0 1 if $$child{'verbose'} > 1
1416 0 1 unless $$child{'CLIENT'}
1447 166 350 if $$this{'LISTEN'}
1448 45 471 if $$this{'CLIENT'}
1449 323 193 if $$this{'SERVER'}