Branch Coverage

blib/lib/Treex/PML/Instance/Writer.pm
Criterion Covered Total %
branch 146 276 52.9


line true false branch
69 5 14 if ($cached and $handler_cache[-1][1] ne $subkey)
81 0 14 if (@handler_cache > $MAX_SCHEMA_CACHE_SIZE)
94 532 3 if ($INDENT >= 0) { }
101 116 1 if ($INDENT > 0) { }
109 116 1 if ($INDENT > 0) { }
121 0 19 if exists $opts->{'validate_cdata'}
123 0 19 if $opts->{'filename'}
126 0 19 if $href eq '-' and not $fh
128 0 19 if ($config and ref(my $load_opts = $config->get_data('options/save')))
132 0 19 if $opts->{'keep_knit'}
133 0 19 if $opts->{'write_single_LM'}
134 0 19 if $opts->{'write_single_children_LM'}
135 0 19 if defined $opts->{'indent'}
136 0 19 unless ($fh)
137 0 0 if (defined $href and length $href) { }
139 0 0 unless $href =~ /^ntred:/
146 0 0 if ($fh)
153 0 0 unless ($ok)
156 0 0 unless $href =~ /^ntred:/
158 0 0 if $err
166 19 0 if $fh
171 0 10 if ($config and defined $transform_id and length $transform_id)
173 0 0 if ($transform) { }
175 0 0 if ($out_xsl->{'type'} ne 'xslt')
180 0 0 unless (defined $out_xsl_href and length $out_xsl_href)
184 0 0 unless open my $pml_fh, '>', \$xsl_source
195 0 9 unless ($_->{'readas'} || '') eq 'dom'
196 0 19 if (ref $refs_to_save) { }
199 0 0 unless (defined $$refs_to_save{$_->{'id'}})
212 9 0 if ($ref->{'readas'} eq 'dom')
225 19 0 if $fh
226 0 19 $ctxt->{'_no_read_trees'} ? :
228 0 19 if $opts->{'dump_handlers'} or $ENV{'PML_COMPILE_DUMP'}
232 10 9 if ($ctxt->{'_pi'})
244 0 19 if defined $orig_fh
245 0 19 if $@
247 0 19 if ($xsl_source and $out_xsl_href)
248 0 0 if XSLT_BUG()
252 0 0 if $params
257 0 0 if (UNIVERSAL::can($result, 'toFH')) { }
266 12 7 if (ref $ctxt->{'_ref'})
268 9 0 if ($ref->{'readas'} eq 'dom') { }
0 0 elsif ($ref->{'readas'} eq 'pml') { }
271 0 9 if (defined $$refs_to_save{$ref->{'id'}}) { }
276 9 0 if (ref $dom)
278 9 0 unless $href =~ /^ntred:/
283 9 0 if ($ref_fh)
290 0 9 unless ($ok)
293 0 0 unless $href =~ /^ntred:/
295 0 0 if $err
301 0 0 if ($pml)
303 0 0 if (exists $refs_to_save->{$ref_id}) { }
310 0 0 $k =~ s[^\Q$ref_id\E/][] ? :
328 5 14 if ($cached) { }
332 14 0 if $CACHE_HANDLERS
338 0 0 unless -d $dir or mkdir $dir
342 0 0 unless open my $fh, '>:utf8', $dump_file
354 1 35 if $decl->is_mixed
370 6 3 if $path
389 1 0 if $path
399 7 0 if $path
402 0 7 if defined $tag
411 0 7 if defined $tag
422 5 0 if $path
425 3 2 if (defined $tag)
426 3 0 unless ($WRITE_SINGLE_LM or $WRITE_SINGLE_CHILDREN_LM)
440 3 2 if (defined $tag)
443 3 0 unless $WRITE_SINGLE_LM or $WRITE_SINGLE_CHILDREN_LM
455 14 0 if ($idM) { }
535 212 245 if $path
536 99 233 if $decl_type == 11 or $decl_type == 12 or $decl_type == 1 or $decl_type == 13
540 14 219 if ($decl_type == 2) { }
36 183 elsif ($decl_type == 3) { }
18 165 elsif ($decl_type == 4) { }
18 147 elsif ($decl_type == 5) { }
29 118 elsif ($decl_type == 6) { }
5 113 elsif ($decl_type == 7) { }
99 14 elsif ($decl_type == 8) { }
14 0 elsif ($decl_type == 9) { }
0 0 elsif ($decl_type == 10) { }
554 4 10 if ($cdecl_type == 10 or $cdecl_type == 3)
557 0 0 if ($attr->is_required) { }
579 1 13 $no_end_indent ? :
630 14 0 $INDENT > 0 ? :
634 0 14 if $@
653 22 2 if ($attr->is_required) { }
674 24 88 if $m->is_attribute
682 3 85 if ($WITH_TREES and $decl->get_role eq '#NODE' and $m->get_role eq '#CHILDNODES') { }
1 84 elsif ($WITH_TREES and $m->get_role eq '#TREES' || $mdecl->get_role eq '#TREES') { }
687 0 3 if ($mdecl_type == 5) { }
3 0 elsif ($mdecl_type == 6) { }
701 1 0 if ($m->is_required)
709 0 1 if ($mdecl_type == 5) { }
1 0 elsif ($mdecl_type == 6) { }
719 0 88 if ($mdecl_type == 10 and not $m->is_required) { }
0 88 elsif ($m->get_role eq '#KNIT') { }
7 81 elsif ($mdecl_type == 6 and $mdecl->get_role eq '#KNIT') { }
735 0 0 unless ($name eq $knit_name)
742 0 0 if ($KEEP_KNIT) { }
750 0 0 if ($m->is_required)
759 0 0 if $close_brace
766 7 0 if ($name ne $knit_name)
774 0 7 if ($m->is_required) { }
785 0 7 if ($KEEP_KNIT) { }
786 0 0 unless ($WRITE_SINGLE_LM)
796 0 0 unless $WRITE_SINGLE_LM
799 7 0 unless ($WRITE_SINGLE_LM)
814 7 0 unless $WRITE_SINGLE_LM
820 7 0 if ($name ne $knit_name)
824 0 7 if $close_brace
837 25 56 if ($m->is_required and not $ignore_required)
845 4 84 if $close_brace
855 0 36 if $@
870 12 6 if (@attributes) { }
876 8 5 if ($attr->is_required) { }
900 18 0 if ($cdecl) { }
905 9 9 if ($WITH_TREES and $decl->get_role eq '#NODE' and $cdecl->get_role eq '#CHILDNODES')
919 7 2 if ($cdecl_type == 5) { }
2 0 elsif ($cdecl_type == 6) { }
936 0 18 $WRITE_SINGLE_LM ? :
946 9 9 if $close_brace
959 0 18 if $@
965 1 17 if $decl->is_mixed
971 9 9 if ($WITH_TREES and $decl->get_role eq '#TREES') { }
995 0 18 if $@
996 1 17 if $decl->is_mixed
1009 0 29 if ($WITH_TREES and $decl->get_role eq '#TREES') { }
1025 29 0 unless ($WRITE_SINGLE_LM)
1045 0 29 if $@
1083 0 5 if $@
1099 0 99 if $@
1102 0 14 unless ($value_hash)
1121 0 14 if $@
1138 0 0 if $@
1146 156 301 if ($decl_type == 11 or $decl_type == 12 or $decl_type == 13)
1152 156 0 if $path
1154 46 110 if (not exists $handlers{$path})
1157 46 0 if $mpath