Branch Coverage

blib/lib/HTML/Tabulate.pm
Criterion Covered Total %
branch 350 498 70.2


line true false branch
96 123 0 wantarray ? :
102 123 0 wantarray ? :
108 0 31 wantarray ? :
122 0 241 unless (exists $valid{$_})
127 0 167 if $type and $type ne 'SCALAR' and not $valid{$_} =~ /$type/
129 0 74 unless $type or $valid{$_} =~ /SCALAR/
132 0 123 if @invalid
134 0 123 if @badtype
142 0 6 unless (exists $valid{$_})
147 0 6 if $type and $type ne 'SCALAR' and not $valid{$_} =~ /$type/
149 0 0 unless $type or $valid{$_} =~ /SCALAR/
152 0 123 if @invalid
154 0 123 if @badtype
162 0 55 if ref $$defn{'field_attr'}{$field} ne 'HASH'
166 45 46 unless exists $valid{$_}
167 0 46 unless $valid{$_}
169 46 0 if (not ref $valid{$_}) { }
0 0 elsif (ref $valid{$_} eq 'ARRAY') { }
170 0 26 if $type and $type ne 'SCALAR' and not $valid{$_} =~ /$type/
172 0 20 unless $type or $valid{$_} =~ /SCALAR/
176 0 0 if ($type) { }
181 0 0 unless grep /^$val$/, @{$valid{$_};}
189 0 55 if @badtype
207 0 246 if ref $hash1 ne 'HASH'
208 0 246 if $hash2 and ref $hash2 ne 'HASH'
213 2 244 if ($single_arg)
220 123 123 unless substr($sub, -7) eq '::merge'
229 153 242 if (ref $$hash2{$key} eq 'HASH' and ref $$merge{$key} eq 'HASH') { }
231 123 30 if (grep /^$key$/, @recurse_keys) { }
246 2 244 if (not defined wantarray) { }
249 0 2 if exists $$self{'defn_t'}
267 0 31 if $defn and ref $defn ne 'HASH'
270 0 31 if $$defn{'table'} and not ref $$defn{'table'}
309 0 7 unless ref $set
310 0 7 if (ref $set eq 'CODE') { }
0 7 elsif (blessed $set and $set->can('Next')) { }
0 7 elsif (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 } }) { }
313 0 0 if eval { do { keys %$row } }
316 0 0 $set->can('First') ? :
318 0 0 if eval { do { keys %$row } }
321 0 0 $set->can('first') ? :
323 0 0 if eval { do { keys %$row } }
327 0 6 unless (@$set)
333 3 3 if (ref $obj eq 'HASH') { }
3 0 elsif (ref $obj eq 'ARRAY') { }
0 0 elsif ($obj->isa('Class::DBI')) { }
338 0 3 if ($$defn{'labels'}) { }
349 0 0 if not @col and $obj->columns('Essential')
351 0 0 unless @col
352 0 0 if @col
355 0 6 unless (ref $$defn{'fields'} and @{$$defn{'fields'};})
356 0 0 unless (defined eval { do { $$defn{'fields'} = [sort(keys %$obj)] } })
364 0 0 if not @col and $set->columns('Essential')
366 0 0 unless @col
367 0 0 if @col
372 1 0 if defined $first
374 0 1 if ($ref) { }
376 0 0 if ($ref eq 'HASH') { }
0 0 elsif (ref $$set[0] ne 'ARRAY') { }
0 0 elsif ($$defn{'labels'}) { }
399 0 7 unless ref $$defn{'fields'} eq 'ARRAY'
412 7 100 if not $$self{'defn_t'}{'fields'} or ref $$self{'defn_t'}{'fields'} ne 'ARRAY' or not @{$$self{'defn_t'}{'fields'};}
421 0 1 unless ref $$defn{'fields'} eq 'ARRAY' and ref $add eq 'HASH'
425 4 2 unless $$add{$f}
426 1 1 if (ref $$add{$f} eq 'ARRAY') { }
450 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) { }
498 1 106 ref $$defn_t{'in_fields'} eq 'ARRAY' ? :
502 1 106 if $$defn_t{'fields_add'}
503 26 81 if $$defn_t{'fields_omit'}
506 10 97 if (ref $$defn_t{'labels'} eq 'HASH')
512 1 106 if (ref $$defn_t{'label_links'} eq 'HASH')
520 0 107 if ($$defn_t{'derived'})
527 1 106 if ($$self{'defn_t'}{'style'} eq 'across' and ref $$defn_t{'thtr'} eq 'HASH')
529 1 0 unless exists $$defn_t{'field_attr'}{-'defaults'}{"label_$_"}
534 8 99 if (ref $$defn_t{'th'} eq 'HASH')
536 8 0 unless exists $$defn_t{'field_attr'}{-'defaults'}{"label_$_"}
541 4 103 if (ref $$defn_t{'td'} eq 'HASH')
549 285 4 unless /^\(\?.*\)$/
555 6 101 if ($$defn_t{'stripe'} and ref $$defn_t{'stripe'} ne 'ARRAY')
560 7 100 if ($$defn_t{'thead'})
562 4 3 unless ref $$defn_t{'thead'}
564 3 104 if ($$defn_t{'tfoot'})
566 2 1 unless ref $$defn_t{'tfoot'}
570 23 84 if ($$defn_t{'tbody'})
571 13 10 if (ref $$defn_t{'tbody'}) { }
574 12 5 if /^-/
603 1 2 if (my $label = $grouped_fields{$f}) { }
612 1 0 if $fn eq $g
616 1 0 if (@next_group == @{$$labelgroups{$label};} - 1) { }
636 1 0 if (@fields2)
638 1 2 if (my $grouped_fields = $$labelgroups{$f}) { }
663 2245 34 if (ref $attr eq 'HASH')
665 24 340 unless defined $$attr{$a}
666 316 24 if ($$attr{$a} ne '') { }
670 12 12 if ($MINIMISED_ATTR{$a}) { }
671 6 6 $xhtml ? :
679 6 2273 if $close and $xhtml
704 0 321 unless grep /^$type$/, ('title', 'text', 'caption')
709 2 319 if (ref $elt eq 'CODE') { }
16 303 elsif (not ref $elt) { }
718 16 0 if ($DEFAULT_DEFN{$type} and ref $DEFAULT_DEFN{$type} eq 'HASH')
725 319 0 if (ref $elt eq 'HASH')
726 294 25 unless defined $$elt{'value'} or defined $$elt{'title'}
729 6 19 if defined $$elt{'value'} and $$elt{'value'} =~ /^\s*\<.*\>\s*$/s
731 0 19 if defined $$elt{'title'} and $$elt{'title'} =~ /^\s*\<.*\>\s*$/s
735 13 4 if defined $$elt{'value'} and defined $$elt{'format'} and not ref $$elt{'format'}
740 3 1 if defined $$elt{'value'} and defined $$elt{'format'} and ref $$elt{'format'} eq 'CODE'
745 2 1 if ($$elt{'title'})
767 7 314 if defined $data and $data ne '' and substr($data, -1) ne "\n"
783 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')) { }
793 1 1 if ($$defn_t{'caption'}{'format'} || '') eq $DEFAULT_TEXT_FORMAT
808 104 3 unless $$self{'defn_t'}{'colgroups'}
812 1 7 if ($$cg{'cols'} and ref $$cg{'cols'} and ref $$cg{'cols'} eq 'ARRAY') { }
834 107 0 if $$self{'defn_t'}{'title'}
835 107 0 if $$self{'defn_t'}{'text'}
843 1 106 if exists $$self{'defn_t'}{'table'} and not $$self{'defn_t'}{'table'}
851 1 106 if exists $$self{'defn_t'}{'table'} and not $$self{'defn_t'}{'table'}
871 0 28 if $ref and $ref ne 'CODE'
872 21 7 if $ref eq 'CODE'
873 7 21 unless $ref
892 0 30 if $ref and $ref ne 'CODE'
894 16 14 if $ref eq 'CODE'
896 14 16 unless $ref
898 30 0 if ($ldata)
903 34 117 if ($attr =~ /^link_/)
906 7 27 ref $val eq 'CODE' ? :
927 108 1522 if $data ne '' and $$defn{'trim'}
932 1515 0 if $data ne '' and $$fattr{'escape'} || !exists($$fattr{'escape'})
936 28 1602 if $$fattr{'format'}
940 30 1600 if $data ne '' and $$fattr{'link'}
944 6 1624 if defined $$defn{'null'} and $data eq ''
956 2 389 if (ref $label eq 'CODE') { }
962 356 35 unless defined $l
963 2 389 if $l eq '' and defined $$self{'defn_t'}{'null'}
986 52 150 if (substr($_, 0, 6) eq 'label_') { }
18 132 elsif (substr($_, 0, 6) eq 'tfoot_') { }
1009 481 112 if exists $$self{'field_attr'}{$_}
1010 13 580 if /^link_/
1011 25 568 if ref $tx_attr{$_} eq 'CODE'
1025 0 391 if $$self{'defn_t'}{'data_attr'}{$field}
1031 9 6 unless $field =~ /$regex/
1056 175 1491 if (exists $$fattr{'value'} and not ref $$fattr{'value'}) { }
1482 18 elsif (ref $row and not $$fattr{'derived'}) { }
1057 175 0 defined $$fattr{'value'} ? :
1062 0 1482 if (blessed $row) { }
1149 333 elsif (ref $row eq 'ARRAY') { }
295 38 elsif (ref $row eq 'HASH' and exists $$row{$field}) { }
1064 0 0 if (eval { do { $row->can($field) } } and $field ne 'delete') { }
0 0 elsif (eval { do { $row->can('get_column') } }) { }
1075 1149 0 keys %{$$defn{'field_map'};} ? :
1076 1143 6 if defined $i
1084 37 1629 if (exists $$fattr{'value'} and ref $$fattr{'value'})
1086 37 0 if ($ref eq 'CODE') { }
1094 0 1666 if not defined $value and exists $$fattr{'default'}
1096 1584 82 defined $value ? :
1107 0 6 unless my $composite = $$fattr{'composite'}
1115 0 6 if (ref $composite_join eq 'CODE') { }
1133 6 1624 if ($$fattr{'composite'}) { }
1145 1630 0 wantarray ? :
1155 153 1457 !defined($row) ? :
1156 0 1610 unless defined $data
1169 79 3 if (ref $v eq 'CODE') { }
1192 1610 20 unless defined $tags
1193 0 1630 if %args
1196 391 1239 unless $$self{'defn_t'}{'data_attr'}{$field}
1200 1630 0 unless ($fattr and $tx_attr)
1201 161 1469 if (not defined $row or $row eq 'thead') { }
12 1457 elsif ($row eq 'tfoot') { }
1218 63 1567 if $tx_code
1222 3 1627 if $tx_attr_extra and $$tx_attr_extra{$field}
1226 1610 20 $tags ? :
1228 4 1606 $$tx_attr{'colspan'} ? :
1610 0 if $skip_count and ref $skip_count and ref $skip_count eq 'SCALAR'
1280 428 31 unless $stripe
1283 22 9 if (defined $$stripe[$r])
1284 13 9 if (not ref $$stripe[$r]) { }
9 0 elsif (ref $$stripe[$r] eq 'HASH') { }
1286 12 1 unless $rownum == 0 and exists $$tr{'bgcolor'}
1292 5 4 if ($$stripe[$r]{'class'} and $$tr{'class'}) { }
1 3 elsif ($rownum == 0) { }
1299 1 0 unless exists $$tr{$_}
1322 286 121 unless $$self{'defn_t'}{'tbody'}
1325 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'}) { }
1326 10 26 unless $$self{'defn_t'}{'tbody_open'}
1332 15 3 if (exists $$self{'defn_t'}{'tbody_field_value'}) { }
1333 8 7 if ($value eq $$self{'defn_t'}{'tbody_field_value'} or not defined $value || defined $$self{'defn_t'}{'tbody_field_value'}) { }
1350 28 26 if int(($rownum - 1) % $r) == 0
1355 2 11 unless $$self{'defn_t'}{'tbody_open'}
1359 50 63 if ($generate)
1360 27 23 if ($$self{'defn_t'}{'tbody_open'})
1377 38 421 if ($rownum == 0) { }
1378 5 33 if $$defn_t{'thtr'}
1382 3 418 if (ref $$defn_t{'tr'} eq 'CODE' and $row) { }
1386 97 321 unless ref $$defn_t{'tr'} eq 'HASH'
1391 16 13 if ref $v eq 'CODE'
1408 1 450 $tx_attr_extra ? :
1418 10 1578 if ($skip_count > 0)
1423 145 1433 if (not $row) { }
1443 0 105 unless ref $set
1444 0 105 if (ref $set eq 'CODE') { }
0 105 elsif (blessed $set and $set->can('Next')) { }
0 105 elsif (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 } }) { }
1446 0 0 $row ? :
1451 0 0 $row ? :
1456 0 0 $row ? :
1461 99 390 if $row > $#$set
1469 6 0 if (not ref $$set{$k}) { }
1471 6 6 if $row++
1479 0 0 if $row > $#k
1497 105 0 if ref $$self{'defn_t'}{'fields'} eq 'ARRAY'
1504 37 68 if ($$self{'defn_t'}{'labels'} and @fields) { }
3 65 elsif ($$self{'defn_t'}{'thead'}) { }
1505 4 33 if $$self{'defn_t'}{'thead'}
1508 1 36 if ($$self{'defn_t'}{'labelgroups'}) { }
1511 1 0 if @$fields2
1517 4 33 if ($$self{'defn_t'}{'thead'})
1524 0 3 $data_prepend && @$data_prepend ? :
1525 3 0 if ($row)
1535 3 102 if ($data_prepend and @$data_prepend)
1547 4 101 if (my $data_append = $$self{'defn_t'}{'data_append'})
1555 23 82 if $$self{'defn_t'}{'tbody_open'}
1558 3 102 if ($$self{'defn_t'}{'tfoot'})
1578 8 0 if ($$self{'defn_t'}{'labels'})
1585 0 24 if ($skip_count > 0)
1606 0 2 unless ref $set
1607 0 2 if (ref $set eq 'CODE') { }
0 2 elsif (blessed $set and $set->can('Next')) { }
0 2 elsif (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 } }) { }
1614 0 0 if (ref $row)
1623 0 0 if (ref $row)
1671 105 2 if ($$defn_t{'style'} eq 'down') { }
2 0 elsif ($$defn_t{'style'} eq 'across') { }
1701 0 107 unless ref $set
1704 6 101 unless (ref $self and blessed $self and $self->isa('HTML::Tabulate'))
1712 90 17 if (ref $defn eq 'HASH' and keys %$defn) { }