Branch Coverage

blib/lib/Treex/PML/Document.pm
Criterion Covered Total %
branch 91 368 24.7


line true false branch
88 25 0 ref $class ? :
90 0 25 if $opts->{'encoding'}
91 25 0 unless $opts->{'backends'}
92 0 25 if ($opts->{'recover'}) { }
0 25 elsif ($error == 1) { }
1 24 elsif ($error) { }
121 0 0 unless ref $_[0]
140 0 25 if (@_ == 1 and ref $_[0] eq 'HASH')
173 0 0 @_ == 1 && ref $_[0] ? :
174 0 0 if (exists $args->{'filename'})
206 0 0 if (ref $self->[13])
209 0 0 if ($deep)
224 0 25 unless ref $self
304 0 25 ref $_[2] ? :
306 0 25 ref $_[4] eq 'ARRAY' ? :
307 0 25 ref $_[5] eq 'ARRAY' ? :
308 0 25 UNIVERSAL::isa($_[6], 'ARRAY') ? :
311 0 25 $_[7] ? :
314 0 25 $_[8] ? :
315 0 25 $_[9] ? :
316 0 25 $_[10] ? :
317 0 25 $_[11] ? :
318 0 25 $_[12] ? :
321 0 25 if (defined $_[0]) { }
326 25 0 ref $self ? :
355 25 0 scalar @_ ? :
0 25 UNIVERSAL::isa($_[0], 'ARRAY') ? :
357 0 25 unless ref $self
360 0 25 if $Treex::PML::Debug
361 1 24 if $@
363 0 24 if $Treex::PML::Debug
365 24 0 if ($backend and eval { do { no strict 'refs'; &{"${backend}::test";}($file, $self->encoding) } })
372 0 24 if $Treex::PML::Debug
376 0 24 if $Treex::PML::Debug
379 0 24 unless &{"${backend}::close_backend";}($fh)
381 0 24 if ($@) { }
392 0 0 if $Treex::PML::Debug
400 0 0 if ($@)
405 0 24 if ($ret == 1)
409 5 19 if ($url ne $file and $remove_file)
431 0 11 unless ref $self
433 6 5 unless defined $filename and $filename ne ''
435 0 11 if $Treex::PML::Debug
442 0 11 unless $fh = &{"${backend}::open_backend";}($filename, 'w', $self->encoding)
444 0 11 unless &{"${backend}::close_backend";}($fh)
450 11 0 if $ret
467 0 0 unless ref $self
470 0 0 if $Treex::PML::Debug
477 0 0 if $@
502 0 42 unless $self
505 7 35 if (defined $filename)
508 0 35 unless $filename = $self->[0]
509 0 35 unless (ref $filename)
513 35 0 if (&blessed($filename) and $filename->isa('URI::file'))
529 0 0 if ($filename and not &blessed($filename) && $filename->isa('URI'))
547 0 24 unless ref $self
563 0 40 unless ref $self
581 0 0 ref $self ? :
594 0 0 unless ref $self
609 11 0 ref $self ? :
622 0 24 unless ref $self
636 60 0 ref $self ? :
649 0 22 unless ref $self
666 0 0 ref $self ? :
680 0 0 unless ref $self
696 119 0 ref $self ? :
711 0 254 unless ref $self
724 0 0 unless ref $self
725 0 0 wantarray ? :
738 48 0 ref $self ? :
753 0 56 unless ref $self
766 0 0 unless ref $self
767 0 0 wantarray ? :
861 1 0 if (defined $id)
879 0 0 if (ref $id_hash)
881 0 0 if (defined $id)
898 0 0 if (ref $id_hash)
917 0 0 if (defined $id)
935 1 0 if (ref $id_hash) { }
950 0 0 if (ref $self->appData('id-hash')) { }
967 0 0 if (ref $id_hash) { }
979 0 0 if ($member)
1045 0 4 unless $self->metaData('fs-require')
1083 0 4 if ref $$ref{$req->[0]}
1086 3 1 if (ref $callback eq 'CODE')
1088 3 0 if (defined $result)
1089 1 2 if (not $result) { }
1 1 elsif (UNIVERSAL::DOES::does($result, 'Treex::PML::Document')) { }
0 1 elsif (&blessed($result) and $result->isa('URI')) { }
1100 2 1 unless (defined $req_fs)
1101 0 2 if $Treex::PML::Debug
1106 2 0 unless (ref $part_of)
1113 0 2 if $recurse
1131 0 2 unless $self->appData('fs-part-of')
1156 0 2 unless ref $self
1160 0 2 if ($enc)
1178 11 0 ref $self ? :
1192 0 2 unless ref $self
1206 0 0 ref $self ? :
1218 0 0 ref $self ? :
1229 11 0 ref $self ? :
1242 0 2 unless ref $self
1257 6 0 ref $self ? :
1271 0 3 unless ref $self
1286 6 0 ref $self ? :
1299 0 24 unless ref $self
1315 70 0 ref $self ? :
1329 2 0 ref $self ? :
1343 0 0 ref $self ? :
1357 0 35 unless ref $self
1358 35 0 if defined $val
1371 0 0 unless ref $self
1372 0 0 if defined $val
1385 0 0 unless ref $self
1386 0 0 if defined $val
1410 0 0 unless ref $document
1413 0 0 if $tree_no < 0
1414 0 0 if $tree_no > $document->lastTreeNo
1422 0 0 if $prevcurrent eq $node
1423 0 0 $show_hidden ? :
1428 0 0 if (defined $attr or length $attr)
1453 0 0 unless $document
1455 0 0 $no_numbers ? :
1469 0 0 unless $document
1476 0 0 unless defined $sentord
1481 0 0 if ($val =~ m[/] || $sentord =~ m[/] and ref $document->metaData('schema')) { }
1484 0 0 unless $value eq '' or $value eq '???' or $node->attr($sentord) >= 999
1491 0 0 if ($wantnodes) { }
1501 0 0 unless $node->{$val} eq '' or $node->{$val} eq '???' or $node->{$sentord} >= 999
1505 0 0 if ($wantnodes) { }
1524 0 0 if $nr
1538 0 0 if not ref $nr or ref $pos
1551 0 0 unless ref $nr
1595 0 0 unless $root
1610 0 0 unless (defined $pos1 and 0 <= $pos1 and $pos1 <= $self->lastTreeNo and defined $pos2 and 0 <= $pos2 and $pos2 <= $self->lastTreeNo)
1614 0 0 if $pos1 == $pos2
1631 0 0 unless (defined $pos1 and 0 <= $pos1 and $pos1 <= $self->lastTreeNo and defined $pos2 and 0 <= $pos2 and $pos2 <= $self->lastTreeNo)
1635 0 0 if $pos1 == $pos2
1657 0 0 unless ref $obj
1659 0 0 unless $type
1660 0 0 if (UNIVERSAL::DOES::does($obj, 'Treex::PML::Schema::Decl')) { }
1661 0 0 if ($obj->get_decl_type == 1)
1668 0 0 unless $obj
1671 0 0 if ($type_is == 13) { }
0 0 elsif ($type_is == 12) { }
1679 0 0 if ($type_is == 5) { }
0 0 elsif ($type_is == 6) { }
1680 0 0 if $type->find_elements_by_content_decl($obj)
1682 0 0 if $type->get_content_decl == $obj
1688 0 0 unless $parent_decl
1690 0 0 if ($parent_decl_type == 13)
1694 0 0 if ($parent_decl_type == 3) { }
0 0 elsif ($parent_decl_type == 4) { }
1695 0 0 if $parent_decl->find_members_by_role('#CHILDNODES')
1698 0 0 if $content_decl and $content_decl->get_role eq '#CHILDNODES'
1727 0 0 if $type
1730 0 0 $node->firstson ? :
1731 0 0 if ($node->parent) { }
1734 0 0 if (ref $parent_decl) { }
1738 0 0 if ($parent_decl_type == 3) { }
0 0 elsif ($parent_decl_type == 4) { }
1743 0 0 unless $member_decl and $member_decl->get_role eq '#CHILDNODES'
1745 0 0 if ($member_decl)
1747 0 0 if ($member_decl_type == 6) { }
0 0 elsif ($member_decl_type == 5) { }
1749 0 0 unless $ntype and $ntype->get_role eq '#NODE' and !$has_children || _can_have_children($ntype)
1754 0 0 unless not $has_children
1758 0 0 if (defined $node->{'#name'})
1760 0 0 if $ntype
1774 0 0 if (ref $document)
1776 0 0 if (ref $pml_trees_type) { }
1784 0 0 unless (ref $tt)
1788 0 0 if ($tt_is == 13 or $tt_is == 12 or $tt_is == 1)
1793 0 0 if ($tt_is == 6) { }
0 0 elsif ($tt_is == 5) { }
1795 0 0 unless $ntype and $ntype->get_role eq '#NODE' and !$has_children || _can_have_children($ntype)
1800 0 0 unless not $has_children
1804 0 0 if (defined $node->{'#name'})
1806 0 0 if $ntype
1814 0 0 if ($ntype) { }
0 0 elsif (@ntypes == 1) { }
0 0 elsif (@ntypes > 1) { }
1823 0 0 if (ref $opts and $opts->{'choose_command'})
1825 0 0 if ($type and grep {$_ == $type;} @ntypes) { }