Branch Coverage

blib/lib/HTML/Tabulate.pm
Criterion Covered Total %
branch 351 500 70.2


line true false branch
97 123 0 wantarray ? :
103 123 0 wantarray ? :
109 0 31 wantarray ? :
123 0 241 unless (exists $valid{$_})
129 0 167 if $type and $type ne "SCALAR" and not $valid{$_} =~ /$type/
131 0 74 unless $type or $valid{$_} =~ /SCALAR/
133 0 123 if @invalid
135 0 123 if @badtype
143 0 6 unless (exists $valid{$_})
149 0 6 if $type and $type ne "SCALAR" and not $valid{$_} =~ /$type/
151 0 0 unless $type or $valid{$_} =~ /SCALAR/
153 0 123 if @invalid
155 0 123 if @badtype
165 0 55 if ref $defn->{'field_attr'}{$field} ne "HASH"
167 45 46 unless exists $valid{$_}
168 0 46 unless $valid{$_}
170 46 0 if (not ref $valid{$_}) { }
0 0 elsif (ref $valid{$_} eq 'ARRAY') { }
172 0 26 if $type and $type ne "SCALAR" and not $valid{$_} =~ /$type/
174 0 20 unless $type or $valid{$_} =~ /SCALAR/
177 0 0 if ($type) { }
182 0 0 unless grep /^$val$/, @{$valid{$_};}
190 0 55 if @badtype
208 0 246 if ref $hash1 ne "HASH"
209 0 246 if $hash2 and ref $hash2 ne "HASH"
214 2 244 if ($single_arg)
221 123 123 unless substr($sub, -7) eq "::merge"
230 153 242 if (ref $hash2->{$key} eq 'HASH' and ref $merge->{$key} eq 'HASH') { }
232 123 30 if (grep /^$key$/, @recurse_keys) { }
247 2 244 if (not defined wantarray) { }
250 0 2 if exists $self->{'defn_t'}
268 0 31 if $defn and ref $defn ne "HASH"
271 0 31 if $defn->{'table'} and not ref $defn->{'table'}
310 0 7 unless ref $set
311 0 7 if (ref $set eq 'CODE') { }
0 7 elsif (builtin::blessed($set) and $set->can('Next')) { }
0 7 elsif (builtin::blessed($set) and $set->can('next')) { }
6 1 elsif (ref $set eq 'ARRAY') { }
0 1 elsif (ref $set and ref $set ne 'HASH' and $set->isa('Class::DBI')) { }
1 0 elsif (defined eval { do { keys %$set } }) { }
314 0 0 if eval { do { keys %$row } }
317 0 0 $set->can('First') ? :
319 0 0 if eval { do { keys %$row } }
322 0 0 $set->can('first') ? :
324 0 0 if eval { do { keys %$row } }
328 0 6 unless (@$set)
334 3 3 if (ref $obj eq 'HASH') { }
3 0 elsif (ref $obj eq 'ARRAY') { }
0 0 elsif ($obj->isa('Class::DBI')) { }
339 0 3 if ($defn->{'labels'}) { }
350 0 0 if not @col and $obj->columns("Essential")
352 0 0 unless @col
353 0 0 if @col
356 0 6 unless (ref $defn->{'fields'} and @{$defn->{'fields'};})
357 0 0 unless (defined eval { do { $defn->{'fields'} = [sort(keys %$obj)] } })
365 0 0 if not @col and $set->columns("Essential")
367 0 0 unless @col
368 0 0 if @col
373 1 0 if defined $first
375 0 1 if ($ref) { }
377 0 0 if ($ref eq 'HASH') { }
0 0 elsif (ref $set->[0] ne 'ARRAY') { }
0 0 elsif ($defn->{'labels'}) { }
402 0 7 unless ref $defn->{'fields'} eq "ARRAY"
413 7 100 if not $self->{'defn_t'}{'fields'} or ref $self->{'defn_t'}{'fields'} ne "ARRAY" or not @{$self->{'defn_t'}{'fields'};}
422 0 1 unless ref $defn->{'fields'} eq "ARRAY" and ref $add eq "HASH"
426 4 2 unless $add->{$f}
427 1 1 if (ref $add->{$f} eq 'ARRAY') { }
451 2488 2816 if (not ref $this) { }
249 2567 elsif (ref $this eq 'ARRAY') { }
2458 109 elsif (ref $this eq 'HASH') { }
109 0 elsif (ref $this eq 'CODE') { }
0 0 elsif (sprintf $this) { }
499 1 106 ref $defn_t->{'in_fields'} eq 'ARRAY' ? :
503 1 106 if $defn_t->{'fields_add'}
504 26 81 if $defn_t->{'fields_omit'}
507 10 97 if (ref $defn_t->{'labels'} eq "HASH")
513 1 106 if (ref $defn_t->{'label_links'} eq "HASH")
521 0 107 if ($defn_t->{'derived'})
528 1 106 if ($self->{'defn_t'}{'style'} eq "across" and ref $defn_t->{'thtr'} eq "HASH")
531 1 0 unless exists $defn_t->{'field_attr'}{'-defaults'}{"label_$_"}
535 8 99 if (ref $defn_t->{'th'} eq "HASH")
538 8 0 unless exists $defn_t->{'field_attr'}{'-defaults'}{"label_$_"}
542 4 103 if (ref $defn_t->{'td'} eq "HASH")
550 285 4 unless /^\(\?.*\)$/
556 6 101 if ($defn_t->{'stripe'} and ref $defn_t->{'stripe'} ne "ARRAY")
561 7 100 if ($defn_t->{'thead'})
563 4 3 unless ref $defn_t->{'thead'}
565 3 104 if ($defn_t->{'tfoot'})
567 2 1 unless ref $defn_t->{'tfoot'}
571 23 84 if ($defn_t->{'tbody'})
572 13 10 if (ref $defn_t->{'tbody'}) { }
575 12 5 if /^-/
604 1 2 if (my $label = $grouped_fields{$f}) { }
613 1 0 if $fn eq $g
617 1 0 if (@next_group == @{$labelgroups->{$label};} - 1) { }
637 1 0 if (@fields2)
639 1 2 if (my $grouped_fields = $labelgroups->{$f}) { }
664 2245 34 if (ref $attr eq "HASH")
666 24 340 unless defined $attr->{$a}
667 316 24 if ($attr->{$a} ne '') { }
671 12 12 if ($MINIMISED_ATTR{$a}) { }
672 6 6 $xhtml ? :
680 6 2273 if $close and $xhtml
705 0 321 unless grep /^$type$/, ("title", "text", "caption")
710 2 319 if (ref $elt eq 'CODE') { }
16 303 elsif (not ref $elt) { }
719 16 0 if ($DEFAULT_DEFN{$type} and ref $DEFAULT_DEFN{$type} eq "HASH")
726 319 0 if (ref $elt eq "HASH")
727 294 25 unless defined $elt->{'value'} or defined $elt->{'title'}
731 6 19 if defined $elt->{'value'} and $elt->{'value'} =~ /^\s*\<.*\>\s*$/s
733 0 19 if defined $elt->{'title'} and $elt->{'title'} =~ /^\s*\<.*\>\s*$/s
738 13 4 if defined $elt->{'value'} and defined $elt->{'format'} and not ref $elt->{'format'}
743 3 1 if defined $elt->{'value'} and defined $elt->{'format'} and ref $elt->{'format'} eq "CODE"
746 2 1 if ($elt->{'title'})
768 7 314 if defined $data and $data ne "" and substr($data, -1) ne "\n"
784 105 109 if ($post_table and ref $defn_t->{'caption'} ne 'HASH' || !$defn_t->{'caption'}{'type'} || $defn_t->{'caption'}{'type'} ne 'caption_caption') { }
2 107 elsif (not $post_table and (ref $defn_t->{'caption'} eq 'HASH' and $defn_t->{'caption'}{'type'} and $defn_t->{'caption'}{'type'} eq 'caption_caption')) { }
795 1 1 if ($defn_t->{'caption'}{'format'} || '') eq $DEFAULT_TEXT_FORMAT
809 104 3 unless $self->{'defn_t'}{'colgroups'}
813 1 7 if ($cg->{'cols'} and ref $cg->{'cols'} and ref $cg->{'cols'} eq 'ARRAY') { }
835 107 0 if $self->{'defn_t'}{'title'}
836 107 0 if $self->{'defn_t'}{'text'}
844 1 106 if exists $self->{'defn_t'}{'table'} and not $self->{'defn_t'}{'table'}
852 1 106 if exists $self->{'defn_t'}{'table'} and not $self->{'defn_t'}{'table'}
872 0 28 if $ref and $ref ne "CODE"
873 21 7 if $ref eq "CODE"
874 7 21 unless $ref
891 0 30 if $ref and $ref ne "CODE"
893 16 14 if $ref eq "CODE"
895 14 16 unless $ref
897 30 0 if ($ldata)
902 34 117 if ($attr =~ /^link_/)
905 7 27 ref $val eq 'CODE' ? :
926 108 1407 if $data ne "" and $defn->{'trim'}
932 1513 2 if $data ne "" and $fattr->{'escape'} || !exists $fattr->{'escape'}
936 28 1602 if $fattr->{'format'}
940 30 1487 if $data ne "" and $fattr->{'link'}
944 6 1624 if defined $defn->{'null'} and $data eq ""
955 2 389 if (ref $label eq 'CODE') { }
961 356 35 unless defined $l
962 2 389 if ($l eq "" and defined $self->{'defn_t'}{'null'})
965 2 0 if $l =~ /&\w+;/
989 52 150 if (substr($_, 0, 6) eq 'label_') { }
18 132 elsif (substr($_, 0, 6) eq 'tfoot_') { }
1012 483 112 if exists $self->{'field_attr'}{$_}
1013 13 582 if /^link_/
1014 25 570 if ref $tx_attr{$_} eq "CODE"
1028 0 391 if $self->{'defn_t'}{'data_attr'}{$field}
1034 9 6 unless $field =~ /$regex/
1059 175 1491 if (exists $fattr->{'value'} and not ref $fattr->{'value'}) { }
1482 18 elsif (ref $row and not $fattr->{'derived'}) { }
1060 175 0 defined $fattr->{'value'} ? :
1065 0 1482 if (builtin::blessed($row)) { }
1149 333 elsif (ref $row eq 'ARRAY') { }
295 38 elsif (ref $row eq 'HASH' and exists $row->{$field}) { }
1067 0 0 if (eval { do { $row->can($field) } } and $field ne 'delete') { }
0 0 elsif (eval { do { $row->can('get_column') } }) { }
1078 1149 0 keys %{$$defn{'field_map'};} ? :
1079 1143 6 if defined $i
1087 37 1629 if (exists $fattr->{'value'} and ref $fattr->{'value'})
1089 37 0 if ($ref eq 'CODE') { }
1097 0 82 if not defined $value and exists $fattr->{'default'}
1099 1584 82 defined $value ? :
1111 0 6 unless my $composite = $fattr->{'composite'}
1118 0 6 if (ref $composite_join eq 'CODE') { }
1136 6 1624 if ($fattr->{'composite'}) { }
1148 1630 0 wantarray ? :
1158 153 1457 !defined($row) ? :
1159 0 1610 unless defined $data
1172 79 3 if (ref $v eq 'CODE') { }
1195 1610 20 unless defined $tags
1196 0 1630 if %args
1200 391 1239 unless $self->{'defn_t'}{'data_attr'}{$field}
1203 1630 0 unless ($fattr and $tx_attr)
1204 161 1469 if (not defined $row or $row eq 'thead') { }
12 1457 elsif ($row eq 'tfoot') { }
1221 63 1567 if $tx_code
1226 3 0 if $tx_attr_extra and $tx_attr_extra->{$field}
1229 1610 20 $tags ? :
1231 4 1606 $tx_attr->{'colspan'} ? :
1610 0 if $skip_count and ref $skip_count and ref $skip_count eq "SCALAR"
1283 428 31 unless $stripe
1286 22 9 if (defined $stripe->[$r])
1287 13 9 if (not ref $stripe->[$r]) { }
9 0 elsif (ref $stripe->[$r] eq 'HASH') { }
1290 12 1 unless $rownum == 0 and exists $tr->{'bgcolor'}
1295 5 4 if ($stripe->[$r]{'class'} and $tr->{'class'}) { }
1 3 elsif ($rownum == 0) { }
1302 1 0 unless exists $tr->{$_}
1325 286 121 unless $self->{'defn_t'}{'tbody'}
1328 36 85 if (not ref $self->{'defn_t'}{'tbody'}) { }
18 67 elsif ($self->{'defn_t'}{'tbody'}{'-field'}) { }
54 13 elsif (my $r = $self->{'defn_t'}{'tbody'}{'-rows'}) { }
1329 10 26 unless $self->{'defn_t'}{'tbody_open'}
1335 15 3 if (exists $self->{'defn_t'}{'tbody_field_value'}) { }
1336 8 7 if ($value eq $self->{'defn_t'}{'tbody_field_value'} or not defined $value || defined $self->{'defn_t'}{'tbody_field_value'}) { }
1353 28 26 if int(($rownum - 1) % $r) == 0
1358 2 11 unless $self->{'defn_t'}{'tbody_open'}
1362 50 63 if ($generate)
1363 27 23 if ($self->{'defn_t'}{'tbody_open'})
1380 38 421 if ($rownum == 0) { }
1381 5 33 if $defn_t->{'thtr'}
1385 3 418 if (ref $defn_t->{'tr'} eq 'CODE' and $row) { }
1389 97 321 unless ref $defn_t->{'tr'} eq "HASH"
1394 16 13 if ref $v eq "CODE"
1411 1 450 $tx_attr_extra ? :
1421 10 1578 if ($skip_count > 0)
1426 145 1433 if (not $row) { }
1446 0 105 unless ref $set
1447 0 105 if (ref $set eq 'CODE') { }
0 105 elsif (builtin::blessed($set) and $set->can('Next')) { }
0 105 elsif (builtin::blessed($set) and $set->can('next')) { }
99 6 elsif (ref $set eq 'ARRAY') { }
6 0 elsif (ref $set eq 'HASH' or eval { do { keys %$set } }) { }
1449 0 0 $row ? :
1454 0 0 $row ? :
1459 0 0 $row ? :
1464 99 390 if $row > $set->$#*
1472 6 0 if (not ref $set->{$k}) { }
1474 6 6 if $row++
1482 0 0 if $row > $#k
1501 105 0 if ref $self->{'defn_t'}{'fields'} eq "ARRAY"
1507 37 68 if ($self->{'defn_t'}{'labels'} and @fields) { }
3 65 elsif ($self->{'defn_t'}{'thead'}) { }
1509 4 33 if $self->{'defn_t'}{'thead'}
1511 1 36 if ($self->{'defn_t'}{'labelgroups'}) { }
1514 1 0 if @$fields2
1520 4 33 if ($self->{'defn_t'}{'thead'})
1527 0 3 $data_prepend && @$data_prepend ? :
1528 3 0 if ($row)
1538 3 102 if ($data_prepend and @$data_prepend)
1550 4 101 if (my $data_append = $self->{'defn_t'}{'data_append'})
1558 23 82 if $self->{'defn_t'}{'tbody_open'}
1561 3 102 if ($self->{'defn_t'}{'tfoot'})
1581 8 0 if ($self->{'defn_t'}{'labels'})
1588 0 24 if ($skip_count > 0)
1609 0 2 unless ref $set
1610 0 2 if (ref $set eq 'CODE') { }
0 2 elsif (builtin::blessed($set) and $set->can('Next')) { }
0 2 elsif (builtin::blessed($set) and $set->can('next')) { }
2 0 elsif (ref $set eq 'ARRAY') { }
0 0 elsif (ref $set eq 'HASH' or eval { do { keys %$set } }) { }
1617 0 0 if (ref $row)
1626 0 0 if (ref $row)
1674 105 2 if ($defn_t->{'style'} eq 'down') { }
2 0 elsif ($defn_t->{'style'} eq 'across') { }
1704 0 107 unless ref $set
1707 6 101 unless (ref $self and builtin::blessed($self) and $self->isa("HTML::Tabulate"))
1715 90 17 if (ref $defn eq 'HASH' and keys %$defn) { }