Branch Coverage

lib/Web/DataService/Output.pm
Criterion Covered Total %
branch 23 638 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 eq 'data_type') { }
0 0 elsif ($key ne 'output') { }
844 0 0 if $vocab eq $1
850 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'
856 0 0 unless $r->{'data_type'} eq 'str'
876 0 0 if ($PROC_KEY{$key}) { }
911 0 0 if $list eq $value
913 0 0 if (ref $list eq 'ARRAY')
917 0 0 if $item eq $value
935 0 0 unless ref $set eq 'HASH'
937 0 0 if $set->{$list}
939 0 0 if (ref $list eq 'ARRAY')
943 0 0 if $set->{$item}
964 4 4 if (ref $item) { }
0 4 elsif ($item =~ qr/ ^ ([!^?] | >>?) (.*) /sx) { }
966 0 4 unless &reftype($item) eq 'HASH'
982 0 0 if ($1 eq '>>') { }
0 0 elsif ($1 eq '>') { }
0 0 elsif ($1 eq '!') { }
985 0 0 if $2 ne ''
1033 2 4 unless ref $node->{'doc_pending'} eq 'ARRAY' and @{$node->{'doc_pending'};}
1039 0 4 unless ref $primary_item
1046 0 4 if ($primary_item->{'disabled'} or $primary_item->{'undocumented'} or $disposition eq 'undocumented')
1050 0 0 if $disposition eq 'undocumented'
1071 0 4 if ($body ne '')
1073 0 0 if $last_pod or $this_pod
1084 4 0 if (defined $primary_item) { }
1113 0 0 if ($1 eq '=over') { }
0 0 elsif ($1 eq '=back') { }
0 0 elsif ($1 eq '=item') { }
0 0 elsif ($1 eq '=head') { }
1121 0 0 if $list_level < 0
1126 0 0 if $list_level == 0
1131 0 0 if $list_level > 0 or $item_body
1167 0 0 unless ref $node and ref $node->{'doc_list'} eq 'ARRAY'
1176 0 0 if $state->{'processed'}{$node->{'name'}}
1195 0 0 do { defined $item->{'include'} } ? :
0 0 ref $item ? :
1197 0 0 if $state->{'items_only'}
1199 0 0 if ($state->{'in_list'})
1201 0 0 if $doc ne ''
1206 0 0 if $doc ne '' and $item ne ''
1217 0 0 unless ref $state->{'namespace'} and &reftype($state->{'namespace'}) eq 'HASH'
1219 0 0 if (defined $item->{'doc_string'} and $item->{'doc_string'} ne '' and not $state->{'items_only'})
1221 0 0 if ($state->{'in_list'})
1223 0 0 if $doc ne ''
1228 0 0 if $doc ne ''
1234 0 0 unless ref $included_node and &reftype($included_node) eq 'HASH'
1238 0 0 if $doc ne '' and $subdoc ne ''
1249 0 0 defined $item->{'name'} ? :
0 0 ref $node eq 'Web::DataService::Set' ? :
1253 0 0 unless ($state->{'in_list'})
1255 0 0 if $doc ne ''
1261 0 0 if defined $item->{'doc_string'} and $item->{'doc_string'} ne ''
1269 0 0 if (--$state->{'level'} == 0)
1271 0 0 if $state->{'in_list'}
1301 0 0 if (ref $ds->{'block'}{$block_name} eq 'Web::DataService::Block') { }
0 0 elsif ($ds->debug) { }
1310 0 0 unless $Web::DataService::QUIET or $ENV{'WDS_QUIET'}
1320 0 0 if ($optional_output and ref $ds->{'set'}{$optional_output} eq 'Web::DataService::Set') { }
0 0 elsif ($optional_output and $ds->debug) { }
1323 0 0 if ref $output_map->{'value_list'} eq 'ARRAY'
1329 0 0 unless defined $block_name
1331 0 0 if $output_map->{'value'}{$label}{'disabled'} or $output_map->{'value'}{$label}{'undocumented'}
1335 0 0 if (ref $ds->{'block'}{$block_name} eq 'Web::DataService::Block')
1346 0 0 unless $Web::DataService::QUIET or $ENV{'WDS_QUIET'}
1352 0 0 unless @blocks
1360 0 0 unless (ref $vocabularies eq 'HASH' and keys %$vocabularies)
1362 0 0 if $ds->debug
1368 0 0 if $vocabularies->{$_} and ref $ds->{'vocab'}{$_}
1370 0 0 unless (@vocab_list)
1372 0 0 if $ds->debug
1384 0 0 if ($field_count > 1) { }
1410 0 0 if $uniq_block{$block_name}
1413 0 0 unless ref $output_list eq 'ARRAY'
1417 0 0 unless defined $r->{'output'}
1419 0 0 unless $r->{'undocumented'}
1436 0 0 unless $summary_block
1444 0 0 unless (ref $vocabularies eq 'HASH' and keys %$vocabularies)
1451 0 0 if $vocabularies->{$_} and ref $ds->{'vocab'}{$_}
1453 0 0 unless (@vocab_list)
1466 0 0 if ($field_count > 1) { }
1482 0 0 unless ref $output_list eq 'ARRAY'
1486 0 0 unless defined $r->{'output'}
1488 0 0 unless $r->{'undocumented'}
1508 0 0 $ds->{'vocab'}{$v}{'use_field_names'} ? :
0 0 defined $r->{'name'} ? :
0 0 defined $$r{"${v}_name"} ? :
1519 0 0 if (defined $r->{'if_block'})
1521 0 0 if (ref $r->{'if_block'} eq 'ARRAY') { }
1549 0 0 unless ref $steps eq 'ARRAY' and @$steps
1558 0 0 if (my $cond_field = $p->{'if_field'}) { }
0 0 elsif ($cond_field = $p->{'not_field'}) { }
1560 0 0 unless defined $record->{$cond_field}
1561 0 0 if ref $record->{$cond_field} eq 'ARRAY' and @{$record->{$cond_field};} == 0
1566 0 0 if defined $record->{$cond_field} and ref $record->{$cond_field} ne 'ARRAY'
1567 0 0 if ref $record->{$cond_field} eq 'ARRAY' and @{$record->{$cond_field};} > 0
1572 0 0 if (defined $p->{'check_field'}) { }
0 0 elsif (defined $p->{'check'}) { }
1588 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'}) { }
1646 0 0 if ($source_field and $source_field ne '*' and not $p->{'always'})
1648 0 0 unless defined $record->{$source_field}
1649 0 0 if ref $record->{$source_field} eq 'ARRAY' and @{$record->{$source_field};} == 0
1659 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'}) { }
1661 0 0 if ($source_field eq '*') { }
0 0 elsif ($p->{'from_each'}) { }
0 0 elsif ($p->{'from'}) { }
1670 0 0 ref $record->{$source_field} eq 'ARRAY' ? :
1688 0 0 if ($p->{'from_each'}) { }
0 0 elsif ($p->{'from'}) { }
0 0 elsif ($set_field ne '*' and not ref $record->{$set_field}) { }
1690 0 0 if (ref $record->{$source_field} eq 'ARRAY') { }
0 0 elsif (not ref $record->{$source_field}) { }
1703 0 0 unless ref $record->{$source_field}
1708 0 0 if defined $record->{$set_field}
1716 0 0 if ($p->{'from_each'}) { }
0 0 elsif ($p->{'from'}) { }
0 0 elsif ($set_field ne '*') { }
1718 0 0 if (ref $record->{$source_field} eq 'ARRAY') { }
0 0 elsif (not ref $record->{$source_field}) { }
1731 0 0 if defined $record->{$source_field} and not ref $record->{$source_field}
1737 0 0 if defined $record->{$set_field} and not ref $record->{$set_field}
1745 0 0 if ($source_field) { }
0 0 elsif ($set_field ne '*') { }
1748 0 0 if ref $record->{$source_field} eq 'ARRAY'
1754 0 0 if ref $record->{$set_field} eq 'ARRAY'
1763 0 0 ref $record->{$source_field} eq 'ARRAY' ? :
1769 0 0 if $set_field eq '*'
1776 0 0 if ($p->{'append'}) { }
1779 0 0 if defined $record->{$set_field} and ref $record->{$set_field} ne 'ARRAY'
1786 0 0 if (@result == 1) { }
0 0 elsif (@result > 1) { }
0 0 elsif (not $p->{'always'}) { }
1821 0 0 unless defined $record->{$field}
1823 0 0 if ($type eq 'int') { }
0 0 elsif ($type eq 'pos') { }
0 0 elsif ($type eq 'dec') { }
0 0 elsif ($type eq 'sci') { }
1825 0 0 if $record->{$field} =~ qr/ ^ -? [1-9][0-9]* $ /x
1830 0 0 if $record->{$field} =~ qr/ ^ [1-9][0-9]* $ /x
1835 0 0 if $record->{$field} =~ qr/ ^ -? (?: [1-9][0-9]* (?: \. [0-9]* )? | [0]? \. [0-9]+ | [0] \.? ) $ /x
1840 0 0 if $record->{$field} =~ qr/ ^ -? (?: [1-9][0-9]* \. [0-9]* | [0]? \. [0-9]+ | [0] \. ) (?: [eE] -? [1-9][0-9]* ) $ /x
1853 0 0 if (defined $subst) { }
1880 0 0 unless $format_class
1897 0 0 unless (ref $field_list and @$field_list)
1906 0 0 if $request->{'hook_enabled'}{'before_record_hook'}
1926 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
1957 0 0 unless $format_class
1966 0 0 if ref $request->{'main_result'}
1972 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
1981 0 0 $format_class->can('emit_separator') ? :
1991 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'}) { }
2004 0 0 unless $ds->_next_record($request)
2020 0 0 if ($request->{'hook_enabled'}{'before_record_hook'})
2029 0 0 if $record->{'_skip_record'}
2031 0 0 if (my $alt = $record->{'_output_block'})
2044 0 0 $emit_rs ? :
2047 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
2059 0 0 if (defined $request->{'result_limit'} and $request->{'result_limit'} ne 'all')
2061 0 0 if $request->{'actual_count'} >= $request->{'result_limit'}
2070 0 0 if (defined $streaming_threshold and length $output > $streaming_threshold)
2083 0 0 unless ($request->{'actual_count'})
2087 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
2099 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
2114 0 0 if ($output_charset and $ds->{'format'}{$format}{'encode_as_text'} and not $request->{'content_type_is_text'})
2121 0 0 $must_encode ? :
2143 0 0 unless $format_class
2164 0 0 if ($request->{'hook_enabled'}{'before_record_hook'})
2172 0 0 if $record->{'_skip_record'}
2174 0 0 if ($record->{'_output_block'})
2196 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
2205 0 0 $format_class->can('emit_separator') ? :
2215 0 0 if (defined $request->{'result_offset'} and $request->{'result_offset'} > 0 and not $request->{'offset_handled'})
2223 0 0 if (defined $request->{'result_limit'} and $request->{'result_limit'} eq '0')
2238 0 0 if $record->{'_output_block'}
2243 0 0 $emit_rs ? :
2246 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
2258 0 0 if (defined $request->{'result_limit'} and $request->{'result_limit'} ne 'all')
2260 0 0 if $request->{'actual_count'} >= $request->{'result_limit'}
2269 0 0 if (defined $streaming_threshold and length $output > $streaming_threshold)
2284 0 0 unless ($request->{'actual_count'})
2288 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
2300 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
2315 0 0 if ($output_charset and $ds->{'format'}{$format}{'encode_as_text'} and not $request->{'content_type_is_text'})
2322 0 0 $must_encode ? :
2351 0 0 unless $format_class
2367 0 0 if ($output_charset and $format_is_text) { }
2388 0 0 if ($request->{'processing_complete'}) { }
2391 0 0 if $record->{'_output_block'}
2398 0 0 if ($request->{'hook_enabled'}{'before_record_hook'})
2407 0 0 if $record->{'_skip_record'}
2409 0 0 if (my $alt = $record->{'_output_block'})
2426 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
2433 0 0 if (not defined $output or $output eq '') { }
0 0 elsif ($output_charset and $format_is_text) { }
2452 0 0 if $request->{'result_limit'} ne 'all' and ++$request->{'actual_count'} >= $request->{'result_limit'}
2466 0 0 if ($request->{'hook_enabled'}{'after_serialize_hook'})
2471 0 0 if (not defined $footer or $footer eq '') { }
0 0 elsif ($output_charset and $format_is_text) { }
2504 0 0 if $request->{'limit_zero'}
2508 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'}) { }
2550 0 0 unless $format_class