Branch Coverage

blib/lib/Config/Hosts.pm
Criterion Covered Total %
branch 53 80 66.2


line true false branch
80 0 99 if ($ip =~ /^$Config::Hosts::IPv6_re$/)
83 60 39 $ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ && ($1 + 0 | $2 + 0 | $3 + 0 | $4 + 0) < 256 ? :
98 79 4 $host =~ /^[a-z]([a-z]|[0-9]|\-|\.)*([a-z]|[0-9])$/i ? :
116 0 6 unless open H, $hosts_file
122 0 18 if (not /\S/) { }
0 18 elsif (/^\s*\#/) { }
18 0 elsif (/^\s*(\d+\.\d+\.\d+\.\d+)\s+(\S.*)/ or /^\s*(\S*\:\S*\:\S*)\s+(\S.*)/) { }
137 0 18 unless (is_valid_ip $ip)
142 0 18 if ($$hosts{$ip})
151 0 24 unless (is_valid_host $host)
154 0 24 if ($$hosts{$host})
185 22 37 if is_valid_ip $candidate
186 36 1 if is_valid_host $candidate
205 37 1 if ($type) { }
225 0 6 unless ($params{'ip'} and $params{'hosts'})
230 0 6 unless (is_valid_ip $ip)
235 1 5 if (not ref $params{'hosts'}) { }
241 0 6 if (ref $hosts ne 'ARRAY')
245 0 11 if not is_valid_host $_
0 6 if (grep {print STDERR "Invalid host $_ passed, ignoring insert\n" if not is_valid_host $_;} @{$hosts;})
252 0 6 $params{'comment'} ? :
254 1 5 if ($$self{'_hosts'}{$ip})
268 0 11 if ($$self{'_hosts'}{$host})
293 0 3 unless ($type)
297 0 3 unless ($$self{'_hosts'}{$host})
303 1 2 if ($type == $TYPE_IP) { }
337 0 4 unless ($type)
341 0 4 unless ($$self{'_hosts'}{$host})
346 0 4 $params{'comment'} ? :
348 0 4 if ($params{'ip'} and not is_valid_ip($params{'ip'}))
352 3 1 if ($params{'hosts'})
353 0 3 unless (ref $params{'hosts'})
356 0 3 if (ref $params{'hosts'} ne 'ARRAY')
360 0 6 if not is_valid_host $_
0 3 if (grep {print STDERR "Invalid host $_ passed, ignoring insert\n" if not is_valid_host $_;} @{$params{'hosts'};})
367 1 3 if ($type == $TYPE_IP and $params{'ip'})
374 2 2 if ($type == $TYPE_IP and $params{'hosts'})
388 2 2 if ($type == $TYPE_HOST and $params{'ip'})
396 1 3 if ($type == $TYPE_HOST and $params{'hosts'})
430 0 1 unless open F, ">$hosts_file"