Branch Coverage

lib/Web/DataService/Output.pm
Criterion Covered Total %
branch 23 624 3.6


line true false branch
38 0 1 if (ref $name) { }
0 1 elsif (not $ds->valid_name($name)) { }
50 0 1 if ($ds->{'block'}{$name}) { }
78 2 2 unless (ref $item)
86 0 2 unless (ref $item eq 'HASH')
98 2 0 if $type eq 'output'
102 0 2 if ($type eq 'include')
172 0 2 if ($k =~ qr/ ^ (\w+) _ (name|value) $ /x) { }
0 2 elsif (not defined $OUTPUT_DEF{$k}) { }
2 0 elsif ($OUTPUT_DEF{$k} eq 'type') { }
0 0 elsif ($OUTPUT_DEF{$k} eq 'single') { }
0 0 elsif ($OUTPUT_DEF{$k} eq 'set') { }
0 0 elsif ($OUTPUT_DEF{$k} eq 'code') { }
0 0 elsif ($OUTPUT_DEF{$k} eq 'hash') { }
0 0 elsif ($OUTPUT_DEF{$k} eq 'regexp') { }
175 0 0 unless defined $ds->{'vocab'}{$1} or defined $ds->{'format'}{$1}
185 0 2 if $type
193 0 0 if ref $v
198 0 0 if ref $v and &reftype($v) ne 'ARRAY'
201 0 0 unless (ref $v)
209 0 0 unless ref $v and &reftype($v) eq 'CODE'
215 0 0 unless ref $v and &reftype($v) eq 'HASH'
221 0 0 if ref $v and &reftype($v) ne 'REGEXP'
228 0 2 unless $type
259 0 0 if $vocab and not $ds->{'vocab'}{$vocab}{'use_field_names'}
279 0 0 if ref $output_list eq 'ARRAY'
285 0 0 if (ref $ds->{'block'}{$block_name} eq 'Web::DataService::Block') { }
306 0 0 if defined $optional_output and ref $ds->{'set'}{$optional_output} eq 'Web::DataService::Set'
308 0 0 if ($output_map) { }
0 0 elsif ($optional_output) { }
312 0 0 unless defined $key
317 0 0 if ($block and ref $ds->{'block'}{$block} eq 'Web::DataService::Block') { }
0 0 elsif ($block) { }
338 0 0 unless (@blocks)
359 0 0 if $uniq_block{$block}
360 0 0 if ++$bound > 999
363 0 0 unless ref $include_list eq 'ARRAY'
371 0 0 if $r->{'if_block'} and not check_set($r->{'if_block'}, $request->{'block_hash'})
374 0 0 if $r->{'not_block'} and check_set($r->{'not_block'}, $request->{'block_hash'})
379 0 0 if $r->{'if_format'} and not check_value($r->{'if_format'}, $format)
382 0 0 if $r->{'not_format'} and check_value($r->{'not_format'}, $format)
387 0 0 if $r->{'if_vocab'} and not check_value($r->{'if_vocab'}, $vocab)
390 0 0 if $r->{'not_vocab'} and check_value($r->{'not_vocab'}, $vocab)
397 0 0 if (ref $output_map->{'value'}{$r->{'include'}}) { }
411 0 0 if $include_block
416 0 0 if $include_key
417 0 0 if $include_block
418 0 0 if $include_block
451 0 0 if $uniq_block->{$block_name}
458 0 0 unless (ref $block_list eq 'ARRAY')
470 0 0 if $vocab and not $ds->{'vocab'}{$vocab}{'use_field_names'}
483 0 0 if $r->{'if_block'} and not check_set($r->{'if_block'}, $request->{'block_hash'})
486 0 0 if $r->{'not_block'} and check_set($r->{'not_block'}, $request->{'block_hash'})
491 0 0 if $r->{'if_format'} and not check_value($r->{'if_format'}, $format)
494 0 0 if $r->{'not_format'} and check_value($r->{'not_format'}, $format)
499 0 0 if $r->{'if_vocab'} and not check_value($r->{'if_vocab'}, $vocab)
502 0 0 if $r->{'not_vocab'} and check_value($r->{'not_vocab'}, $vocab)
507 0 0 if ($r->{'select'}) { }
0 0 elsif (defined $r->{'filter'}) { }
0 0 elsif (defined $r->{'set'} or defined $r->{'check'}) { }
0 0 elsif (defined $r->{'output'}) { }
0 0 elsif (defined $r->{'include_block'}) { }
510 0 0 if ref $r->{'select'} and ref $r->{'select'} ne 'ARRAY'
513 0 0 ref $r->{'select'} ? :
517 0 0 if exists $request->{'select_hash'}{$s}
522 0 0 if ($r->{'tables'})
525 0 0 if ref $r->{'tables'} and ref $r->{'tables'} ne 'ARRAY'
528 0 0 ref $r->{'tables'} ? :
539 0 0 unless $SELECT_KEY{$k}
558 0 0 if ($PROC_KEY{$key}) { }
575 0 0 if (defined $r->{'check'})
581 0 0 if ($check_value eq '*' or $check_value eq '') { }
0 0 elsif (defined $r->{'lookup'}) { }
584 0 0 unless ref $r->{'code'} eq 'CODE'
590 0 0 unless ref $r->{'lookup'} eq 'HASH'
601 0 0 unless $r->{'output'} ne ''
603 0 0 if $require_vocab and not exists $$r{"${vocab}_name"}
610 0 0 if ($FIELD_KEY{$key}) { }
0 0 elsif ($key =~ qr/ ^ (\w+) _ (name|value) $ /x) { }
0 0 elsif ($key eq 'data_type') { }
0 0 elsif ($key ne 'output') { }
612 0 0 unless $key eq 'value' and $vs_value or $key eq 'name' and $vs_name
618 0 0 if ($1 eq $vocab or $1 eq $format)
621 0 0 if $2 eq 'value'
622 0 0 if $2 eq 'name'
629 0 0 unless lc $type_value eq 'int' or lc $type_value eq 'pos' or lc $type_value eq 'dec' or lc $type_value eq 'str'
635 0 0 unless $r->{'data_type'} eq 'str'
660 0 0 if $uniq_block->{$include_block}
668 0 0 unless (ref $add_list eq 'ARRAY')
695 0 0 if (ref $ds->{'set'}{$output_name} eq 'Web::DataService::Set')
713 0 0 if (ref $ds->{'block'}{$output_name} eq 'Web::DataService::Block')
735 0 0 unless ref $output_map eq 'Web::DataService::Set'
739 0 0 if ref $output_map->{'fixed'} eq 'ARRAY'
747 0 0 if defined $output_param and ref $request->{'params'}{$output_param} eq 'ARRAY'
770 0 0 if exists $request->{'block_field_list'}{$block_name}
778 0 0 if $vocab and not $ds->{'vocab'}{$vocab}{'use_field_names'}
786 0 0 unless (ref $block_list eq 'ARRAY')
804 0 0 if $r->{'if_block'} and not check_set($r->{'if_block'}, $request->{'block_set'})
807 0 0 if $r->{'not_block'} and check_set($r->{'not_block'}, $request->{'block_set'})
812 0 0 if $r->{'if_format'} and not check_value($r->{'if_format'}, $format)
815 0 0 if $r->{'not_format'} and check_value($r->{'not_format'}, $format)
820 0 0 if $r->{'if_vocab'} and not check_value($r->{'if_vocab'}, $vocab)
823 0 0 if $r->{'not_vocab'} and check_value($r->{'not_vocab'}, $vocab)
829 0 0 if (defined $r->{'output'}) { }
0 0 elsif (defined $r->{'set'}) { }
831 0 0 if $require_vocab and not exists $$r{"${vocab}_name"}
837 0 0 if ($FIELD_KEY{$key}) { }
0 0 elsif ($key =~ qr/ ^ (\w+) _ (name|value) $ /x) { }
0 0 elsif ($key ne 'output') { }
844 0 0 if $vocab eq $1
864 0 0 if ($PROC_KEY{$key}) { }
899 0 0 if $list eq $value
901 0 0 if (ref $list eq 'ARRAY')
905 0 0 if $item eq $value
923 0 0 unless ref $set eq 'HASH'
925 0 0 if $set->{$list}
927 0 0 if (ref $list eq 'ARRAY')
931 0 0 if $set->{$item}
952 4 4 if (ref $item) { }
0 4 elsif ($item =~ qr/ ^ ([!^?] | >>?) (.*) /sx) { }
954 0 4 unless &reftype($item) eq 'HASH'
970 0 0 if ($1 eq '>>') { }
0 0 elsif ($1 eq '>') { }
0 0 elsif ($1 eq '!') { }
973 0 0 if $2 ne ''
1021 2 4 unless ref $node->{'doc_pending'} eq 'ARRAY' and @{$node->{'doc_pending'};}
1027 0 4 unless ref $primary_item
1034 0 4 if ($primary_item->{'disabled'} or $primary_item->{'undocumented'} or $disposition eq 'undocumented')
1038 0 0 if $disposition eq 'undocumented'
1059 0 4 if ($body ne '')
1061 0 0 if $last_pod or $this_pod
1072 4 0 if (defined $primary_item) { }
1101 0 0 if ($1 eq '=over') { }
0 0 elsif ($1 eq '=back') { }
0 0 elsif ($1 eq '=item') { }
0 0 elsif ($1 eq '=head') { }
1109 0 0 if $list_level < 0
1114 0 0 if $list_level == 0
1119 0 0 if $list_level > 0 or $item_body
1155 0 0 unless ref $node and ref $node->{'doc_list'} eq 'ARRAY'
1164 0 0 if $state->{'processed'}{$node->{'name'}}
1183 0 0 do { defined $item->{'include'} } ? :
0 0 ref $item ? :
1185 0 0 if $state->{'items_only'}
1187 0 0 if ($state->{'in_list'})
1189 0 0 if $doc ne ''
1194 0 0 if $doc ne '' and $item ne ''
1205 0 0 unless ref $state->{'namespace'} and &reftype($state->{'namespace'}) eq 'HASH'
1207 0 0 if (defined $item->{'doc_string'} and $item->{'doc_string'} ne '' and not $state->{'items_only'})
1209 0 0 if ($state->{'in_list'})
1211 0 0 if $doc ne ''
1216 0 0 if $doc ne ''
1222 0 0 unless ref $included_node and &reftype($included_node) eq 'HASH'
1226 0 0 if $doc ne '' and $subdoc ne ''
1237 0 0 defined $item->{'name'} ? :
0 0 ref $node eq 'Web::DataService::Set' ? :
1241 0 0 unless ($state->{'in_list'})
1243 0 0 if $doc ne ''
1249 0 0 if defined $item->{'doc_string'} and $item->{'doc_string'} ne ''
1257 0 0 if (--$state->{'level'} == 0)
1259 0 0 if $state->{'in_list'}
1289 0 0 if (ref $ds->{'block'}{$block_name} eq 'Web::DataService::Block') { }
0 0 elsif ($ds->debug) { }
1298 0 0 unless $Web::DataService::QUIET or $ENV{'WDS_QUIET'}
1308 0 0 if ($optional_output and ref $ds->{'set'}{$optional_output} eq 'Web::DataService::Set') { }
0 0 elsif ($optional_output and $ds->debug) { }
1311 0 0 if ref $output_map->{'value_list'} eq 'ARRAY'
1317 0 0 unless defined $block_name
1319 0 0 if $output_map->{'value'}{$label}{'disabled'} or $output_map->{'value'}{$label}{'undocumented'}
1323 0 0 if (ref $ds->{'block'}{$block_name} eq 'Web::DataService::Block')
1334 0 0 unless $Web::DataService::QUIET or $ENV{'WDS_QUIET'}
1340 0 0 unless @blocks
1348 0 0 unless (ref $vocabularies eq 'HASH' and keys %$vocabularies)
1350 0 0 if $ds->debug
1356 0 0 if $vocabularies->{$_} and ref $ds->{'vocab'}{$_}
1358 0 0 unless (@vocab_list)
1360 0 0 if $ds->debug
1372 0 0 if ($field_count > 1) { }
1398 0 0 if $uniq_block{$block_name}
1401 0 0 unless ref $output_list eq 'ARRAY'
1405 0 0 unless defined $r->{'output'}
1407 0 0 unless $r->{'undocumented'}
1424 0 0 unless $summary_block
1432 0 0 unless (ref $vocabularies eq 'HASH' and keys %$vocabularies)
1439 0 0 if $vocabularies->{$_} and ref $ds->{'vocab'}{$_}
1441 0 0 unless (@vocab_list)
1454 0 0 if ($field_count > 1) { }
1470 0 0 unless ref $output_list eq 'ARRAY'
1474 0 0 unless defined $r->{'output'}
1476 0 0 unless $r->{'undocumented'}
1496 0 0 $ds->{'vocab'}{$v}{'use_field_names'} ? :
0 0 defined $r->{'name'} ? :
0 0 defined $$r{"${v}_name"} ? :
1507 0 0 if (defined $r->{'if_block'})
1509 0 0 if (ref $r->{'if_block'} eq 'ARRAY') { }
1537 0 0 unless ref $steps eq 'ARRAY' and @$steps
1546 0 0 if (my $cond_field = $p->{'if_field'}) { }
0 0 elsif ($cond_field = $p->{'not_field'}) { }
1548 0 0 unless defined $record->{$cond_field}
1549 0 0 if ref $record->{$cond_field} eq 'ARRAY' and @{$record->{$cond_field};} == 0
1554 0 0 if defined $record->{$cond_field} and ref $record->{$cond_field} ne 'ARRAY'
1555 0 0 if ref $record->{$cond_field} eq 'ARRAY' and @{$record->{$cond_field};} > 0
1560 0 0 if (defined $p->{'check_field'}) { }
0 0 elsif (defined $p->{'check'}) { }
1576 0 0 if ($check_value eq '' or $check_value eq '*') { }
0 0 elsif ($check_value eq '1' or $check_value eq '0') { }
0 0 elsif (defined $p->{'code'}) { }
0 0 elsif (defined $p->{'lookup'}) { }
1634 0 0 if ($source_field and $source_field ne '*' and not $p->{'always'})
1636 0 0 unless defined $record->{$source_field}
1637 0 0 if ref $record->{$source_field} eq 'ARRAY' and @{$record->{$source_field};} == 0
1647 0 0 if (ref $p->{'code'} eq 'CODE') { }
0 0 elsif (ref $p->{'lookup'} eq 'HASH') { }
0 0 elsif (defined $p->{'split'}) { }
0 0 elsif (defined $p->{'join'}) { }
1649 0 0 if ($source_field eq '*') { }
0 0 elsif ($p->{'from_each'}) { }
0 0 elsif ($p->{'from'}) { }
1658 0 0 ref $record->{$source_field} eq 'ARRAY' ? :
1676 0 0 if ($p->{'from_each'}) { }
0 0 elsif ($p->{'from'}) { }
0 0 elsif ($set_field ne '*' and not ref $record->{$set_field}) { }
1678 0 0 if (ref $record->{$source_field} eq 'ARRAY') { }
0 0 elsif (not ref $record->{$source_field}) { }
1691 0 0 unless ref $record->{$source_field}
1696 0 0 if defined $record->{$set_field}
1704 0 0 if ($p->{'from_each'}) { }
0 0 elsif ($p->{'from'}) { }
0 0 elsif ($set_field ne '*') { }
1706 0 0 if (ref $record->{$source_field} eq 'ARRAY') { }
0 0 elsif (not ref $record->{$source_field}) { }
1719 0 0 if defined $record->{$source_field} and not ref $record->{$source_field}
1725 0 0 if defined $record->{$set_field} and not ref $record->{$set_field}
1733 0 0 if ($source_field) { }
0 0 elsif ($set_field ne '*') { }
1736 0 0 if ref $record->{$source_field} eq 'ARRAY'
1742 0 0 if ref $record->{$set_field} eq 'ARRAY'
1751 0 0 ref $record->{$source_field} eq 'ARRAY' ? :
1757 0 0 if $set_field eq '*'
1764 0 0 if ($p->{'append'}) { }
1767 0 0 if defined $record->{$set_field} and ref $record->{$set_field} ne 'ARRAY'
1774 0 0 if (@result == 1) { }
0 0 elsif (@result > 1) { }
0 0 elsif (not $p->{'always'}) { }
1809 0 0 unless defined $record->{$field}
1811 0 0 if ($type eq 'int') { }
0 0 elsif ($type eq 'pos') { }
0 0 elsif ($type eq 'dec') { }
0 0 elsif ($type eq 'sci') { }
1813 0 0 if $record->{$field} =~ qr/ ^ -? [1-9][0-9]* $ /x
1818 0 0 if $record->{$field} =~ qr/ ^ [1-9][0-9]* $ /x
1823 0 0 if $record->{$field} =~ qr/ ^ -? (?: [1-9][0-9]* (?: \. [0-9]* )? | [0]? \. [0-9]+ | [0] \.? ) $ /x
1828 0 0 if $record->{$field} =~ qr/ ^ -? (?: [1-9][0-9]* \. [0-9]* | [0]? \. [0-9]+ | [0] \. ) (?: [eE] -? [1-9][0-9]* ) $ /x
1841 0 0 if (defined $subst) { }
1868 0 0 unless $format_class
1886 0 0 unless (ref $field_list and @$field_list)
1898 0 0 if ($ds->{'hook_enabled'}{'before_record_hook'})
1917 0 0 if ($serial_hook)
1948 0 0 unless $format_class
1963 0 0 if ref $request->{'main_result'}
1969 0 0 if ($serial_hook)
1978 0 0 $format_class->can('emit_separator') ? :
1988 0 0 if (defined $request->{'result_limit'} and $request->{'result_limit'} eq '0') { }
0 0 elsif (defined $request->{'result_offset'} and $request->{'result_offset'} > 0 and not $request->{'offset_handled'}) { }
2001 0 0 unless $ds->_next_record($request)
2019 0 0 if ($ds->{'hook_enabled'}{'before_record_hook'})
2023 0 0 if $request->{'_skip_record'}
2029 0 0 $emit_rs ? :
2032 0 0 if ($serial_hook)
2044 0 0 if (defined $request->{'result_limit'} and $request->{'result_limit'} ne 'all')
2046 0 0 if $request->{'actual_count'} >= $request->{'result_limit'}
2055 0 0 if (defined $streaming_threshold and length $output > $streaming_threshold)
2068 0 0 unless ($request->{'actual_count'})
2072 0 0 if ($serial_hook)
2084 0 0 if ($serial_hook)
2099 0 0 if ($output_charset and $ds->{'format'}{$format}{'encode_as_text'} and not $request->{'content_type_is_text'})
2106 0 0 $must_encode ? :
2128 0 0 unless $format_class
2153 0 0 unless $ds->process_record($request, $record, $proc_list)
2158 0 0 if ($ds->{'hook_enabled'}{'before_record_hook'})
2162 0 0 if $request->{'_skip_record'}
2178 0 0 if ($serial_hook)
2187 0 0 $format_class->can('emit_separator') ? :
2197 0 0 if (defined $request->{'result_offset'} and $request->{'result_offset'} > 0 and not $request->{'offset_handled'})
2205 0 0 if (defined $request->{'result_limit'} and $request->{'result_limit'} eq '0')
2220 0 0 $emit_rs ? :
2223 0 0 if ($serial_hook)
2235 0 0 if (defined $request->{'result_limit'} and $request->{'result_limit'} ne 'all')
2237 0 0 if $request->{'actual_count'} >= $request->{'result_limit'}
2246 0 0 if (defined $streaming_threshold and length $output > $streaming_threshold)
2261 0 0 unless ($request->{'actual_count'})
2265 0 0 if ($serial_hook)
2277 0 0 if ($serial_hook)
2292 0 0 if ($output_charset and $ds->{'format'}{$format}{'encode_as_text'} and not $request->{'content_type_is_text'})
2299 0 0 $must_encode ? :
2328 0 0 unless $format_class
2350 0 0 if ($output_charset and $format_is_text) { }
2368 0 0 unless ($request->{'processing_complete'})
2375 0 0 if ($ds->{'hook_enabled'}{'before_record_hook'})
2379 0 0 if $request->{'_skip_record'}
2389 0 0 if ($serial_hook)
2396 0 0 if (not defined $output or $output eq '') { }
0 0 elsif ($output_charset and $format_is_text) { }
2415 0 0 if $request->{'result_limit'} ne 'all' and ++$request->{'actual_count'} >= $request->{'result_limit'}
2429 0 0 if ($serial_hook)
2434 0 0 if (not defined $footer or $footer eq '') { }
0 0 elsif ($output_charset and $format_is_text) { }
2467 0 0 if $request->{'limit_zero'}
2471 0 0 if (ref $request->{'stashed_results'} eq 'ARRAY') { }
0 0 elsif (ref $request->{'main_result'} eq 'ARRAY' and @{$request->{'main_result'};}) { }
0 0 elsif (ref $request->{'main_sth'}) { }
2513 0 0 unless $format_class