Branch Coverage

lib/Nagios/Object/Config.pm
Criterion Covered Total %
branch 129 188 68.6


line true false branch
69 0 19 ref $_[0] ? :
83 19 0 if (@_ % 2 == 0) { }
90 9 10 if (not $fast_mode and $args{'version'}) { }
91 9 0 if ($args{'version'} >= 2) { }
0 0 elsif ($args{'version'} < 2) { }
96 7 126 if (($Nagios::Object::Config::nagios_setup{$key}{'use'}[1] & NAGIOS_V1_ONLY()) == NAGIOS_V1_ONLY())
108 0 0 if (($Nagios::Object::Config::nagios_setup{$key}{'use'}[1] & NAGIOS_V2()) == NAGIOS_V2())
120 1 18 if ($args{'regexp_matching'}) { }
1 17 elsif ($args{'true_regexp_matching'}) { }
137 0 0 if ($_[1])
142 2 0 if ($_[1])
166 0 43 unless open $fh, "<$filename"
175 42 8089 if eof $_[0]
179 1434 6655 if $line =~ /^[#;]/
187 3 8086 if ($append)
188 0 3 unless $line
189 3 0 unless ($append =~ / $/ or $line =~ /^ /)
194 2 8087 if ($line and $line =~ /\\$/)
203 2860 5227 if $line eq ' '
205 0 5227 if ($line =~ m[(include|cfg)_file\s*=\s*([\w\-/\\\:\.]+)])
207 0 0 if -f "$dirname/$incfile"
210 0 5227 if ($line =~ m[(include|cfg)_dir\s*=\s*([\w\-/\\\:\.]+)])
213 0 0 if $_ =~ /\.cfg$/ and -f $_
0 0 if -d "$dirname/$incdir"
223 570 4657 if ($line =~ /}(\s*)$/) { }
571 4086 elsif ($line =~ /define\s+(\w+)\s*{?(.*)$/) { }
1 4085 elsif (not $in_definition) { }
4085 0 elsif ($in_definition) { }
234 0 571 if ($in_definition) { }
0 571 elsif (not 'Nagios::Object'->validate_object_type($type)) { }
272 656 3429 if (not $fast_mode and $1 and $current->can('set_comment'))
278 4080 5 if ($current->can($set_method)) { }
1 4 elsif ($strict_mode) { }
280 0 4080 if $key eq 'notes' and defined $comment
300 550 3534 if ($key eq 'name' or $key eq $Nagios::Object::Config::nagios_setup{$current->setup_key}{'name'}[0])
310 0 42 if ($in_definition)
335 871 5 if ($type and $type =~ /^Nagios::/) { }
5 0 elsif (not $type) { }
337 858 13 if scalar @objl
346 5 49 if ($n and $n eq $name)
365 1506 0 if ($type and $type =~ /^Nagios::(.*)/)
367 1354 152 if (exists $$self{$index_type} and exists $$self{$index_type}{$name})
394 0 13 if (not $type) { }
403 20 22 if ($objname and $objname =~ /$re/)
445 0 17 unless $obj_type =~ /^Nagios::(.*)$/
451 17 0 if (exists $$self{$list_type})
471 150 118 unless $key =~ /_list$/ and ref $$self{$key} eq 'ARRAY'
488 0 0 if not $what and $what != 0
492 0 0 if (defined $type and $type =~ /^Nagios::(.*)$/) { }
503 0 0 if ($obj->has_attribute($attribute) and $obj->$attribute eq $what)
536 312 541 if $object->resolved
541 244 297 if (exists $$object{'use'} and defined $$object{'use'} and not exists $$object{'_use'})
565 237 543 if $object->registered
568 40 503 unless $object->register
571 0 503 unless $object->resolved
577 503 12870 if $attribute eq 'use' or $attribute eq 'register'
579 6392 6478 unless defined $object->$attribute
584 5274 1204 unless $attr_type =~ /^Nagios::.*$/ or ref $attr_type eq 'ARRAY'
587 565 639 if (not ref $attr_type and $object->attribute_is_list($attribute)) { }
4 635 elsif (ref $attr_type eq 'ARRAY') { }
599 0 4 unless ref $values eq 'ARRAY'
617 488 147 if (scalar @refl == 1) { }
8 139 elsif (scalar @refl > 1 and $object->can('host_name') || $object->can('hostgroup_name')) { }
626 65 0 if ($self->can($method))
627 62 3 if (ref $self->$method eq 'ARRAY') { }
1 2 elsif (defined $self->$method) { }
629 0 64 if (ref $_ eq '') { }
645 63 0 if ($self->can('hostgroup_name'))
646 1 62 if (ref $self->hostgroup_name eq 'ARRAY') { }
1 61 elsif (defined $self->hostgroup_name) { }
648 0 1 ref $hg eq '' ? :
654 1 0 ref $self->hostgroup_name eq '' ? :
666 0 55 unless scalar @h2
669 8 47 if grep {$h eq $_;} @h2
672 8 47 if ($found > $old_found)
681 84 1120 if (($Nagios::Object::Config::nagios_setup{$object->setup_key}{$attribute}[1] & NAGIOS_GROUP_SYNC()) == NAGIOS_GROUP_SYNC())
682 75 9 $attribute eq 'members' ? :
688 0 164 unless $o->can($method)
692 12 152 if (not $o->registered) { }
142 10 elsif (not $members && grep({$object eq $_;} @$members)) { }
693 1 11 if (defined $members and ref $members eq '') { }
721 50 515 if (ref $value eq 'ARRAY') { }
730 4 561 if (@to_find == 1 and $to_find[0] eq '*')
732 0 4 unless @found > 0
746 609 13 if (not +($$self{'_regexp_matching_enabled'} || $$self{'_true_regexp_matching_enabled'}) && ($$self{'_true_regexp_matching_enabled'} || $item =~ /[\*\?]/)) { }
754 599 10 if $ref
763 0 13 unless ($$self{'_true_regexp_matching_enabled'})
769 0 13 unless @ret > 0
886 15 7 wantarray ? :
916 0 0 unless $s->service_description
917 0 0 if ($s->host_name)
919 0 0 if ($h->host_name eq $self->host_name)
924 0 0 if ($s->hostgroup_name)
927 0 0 if ($h->host_name eq $self->host_name)