| 1 | package XML::Struct::Reader; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | our @CARP_NOT = qw(XML::Struct); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use XML::Struct; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 5 | our $VERSION = '0.25'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 41 | ▶ | has whitespace => (is => 'ro', default => sub { 0 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 31 | ▶ | has attributes => (is => 'ro', default => sub { 1 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 31 | ▶ | has path => (is => 'ro', default => sub { '*' }, isa => \&_checkPath); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | has stream => (is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | XML::LibXML::Reader->new( { IO => \*STDIN } ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
_build_stream: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | isa => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 40 | ▶ | die 'stream must be an XML::LibXML::Reader' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=14.2
Branch: 1 branch
Condition33%1/3
builtin::blessed($_[0]) and $_[0]->isa("XML::LibXML::Reader")
MC/DC0%0/2
builtin::blessed($_[0]) and $_[0]->isa("XML::LibXML::Reader")
builtin::blessed($_[0])
$_[0]->isa("XML::LibXML::Reader")
Truth table33%1/3
A and B
A= builtin::blessed($_[0])B= $_[0]->isa("XML::LibXML::Reader")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | unless blessed $_[0] && $_[0]->isa('XML::LibXML::Reader'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 5 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 5 | has from => (is => 'ro', trigger => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 37 | ▶ | has ns => (is => 'ro', default => sub { 'keep' }, trigger => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | has depth => (is => 'ro', coerce => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 11 | ▶ | (defined $_[0] and $_[0] =~ /^\+?\d+/) ? $_[0] : undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
Condition100%3/3
defined $_[0] and $_[0] =~ /^\+?\d+/
MC/DC100%2/2
defined $_[0] and $_[0] =~ /^\+?\d+/
defined $_[0]
$_[0] =~ /^\+?\d+/
Truth table100%3/3
A and B
A= defined $_[0]B= $_[0] =~ /^\+?\d+/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 5 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 37 | ▶ | has deep => (is => 'ro', default => sub { '' } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 25 | ▶ | has simple => (is => 'ro', default => sub { 0 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 33 | ▶ | has root => (is => 'ro', default => sub { 0 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 41 | ▶ | has content => (is => 'ro', default => sub { 'content' }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 5 | use XML::LibXML::Reader qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | XML_READER_TYPE_ELEMENT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | XML_READER_TYPE_TEXT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | XML_READER_TYPE_CDATA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | XML_READER_TYPE_SIGNIFICANT_WHITESPACE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | XML_READER_TYPE_END_ELEMENT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 5 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 42 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=13 SCAR=27.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # make sure that option 'deep' and 'depth' are only set if it makes sense | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 42 | ▶ | if ($self->deep eq 'simple') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 3 | ▶ | if ($self->simple or (defined $self->depth and $self->depth == 0)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$self->simple or defined $self->depth and $self->depth == 0
defined $self->depth and $self->depth == 0
MC/DC0%0/3
$self->simple or defined $self->depth and $self->depth == 0
$self->simple
defined $self->depth
$self->depth == 0
Truth table50%2/4
A or B and C
A= $self->simpleB= defined $self->depthC= $self->depth == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # (deep = simple, simple = 1) or (deep = simple, depth = 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 3 | $self->{simple} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 3 | delete $self->{depth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 3 | $self->{deep} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } elsif ($self->deep eq 'struct') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $self->{deep} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } elsif ($self->deep eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 37 | ▶ | $self->{deep} = $self->simple ? '' : 'simple'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } elsif ($self->deep !~ /^(dom|raw)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | croak "option deep must be simple, struct, dom, or raw!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 42 | ▶ | if (($self->depth || 0) and $self->root and $self->simple) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition87%7/8
$self->depth || 0 and $self->root and $self->simple
$self->depth || 0 and $self->root
$self->depth or 0
MC/DC66%2/3
$self->depth || 0 and $self->root and $self->simple
$self->depth
$self->root
$self->simple
Truth table75%3/4
A and B and C
A= $self->depthB= $self->rootC= $self->simple
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 2 | $self->{depth} = $self->{depth}-1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | sub _trigger_from { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 40 | ▶ | my ($self, $from) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_from: called CC=22 SCAR=36.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 40 | ▶ | unless (blessed $from and $from->isa('XML::LibXML::Reader')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($from) and $from->isa("XML::LibXML::Reader")
MC/DC100%2/2
builtin::blessed($from) and $from->isa("XML::LibXML::Reader")
builtin::blessed($from)
$from->isa("XML::LibXML::Reader")
Truth table100%3/3
A and B
A= builtin::blessed($from)B= $from->isa("XML::LibXML::Reader")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 31 | my %options; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 31 | ▶ | if (ref $from and ref $from eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $from and ref $from eq "HASH"
MC/DC0%0/2
ref $from and ref $from eq "HASH"
ref $from
ref $from eq "HASH"
Truth table66%2/3
A and B
A= ref $fromB= ref $from eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | %options = %$from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | $from = delete $options{from} if exists $options{from}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 31 | ▶ | if (!defined $from or $from eq '-') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 9 branches
Condition33%1/3
not defined $from or $from eq "-"
MC/DC0%0/2
not defined $from or $from eq "-"
not defined $from
$from eq "-"
Truth table33%1/3
not(A) or B
A= not defined $fromB= $from eq "-"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $options{IO} = \*STDIN | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | ▶ | } elsif( !ref $from and $from =~ /^</ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
not ref $from and $from =~ /^</
MC/DC100%2/2
not ref $from and $from =~ /^</
not ref $from
$from =~ /^</
Truth table100%3/3
not(A) and B
A= not ref $fromB= $from =~ /^</
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 9 | $options{string} = $from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ▶ | } elsif( ref $from and ref $from eq 'SCALAR' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
ref $from and ref $from eq "SCALAR"
MC/DC100%2/2
ref $from and ref $from eq "SCALAR"
ref $from
ref $from eq "SCALAR"
Truth table100%3/3
A and B
A= ref $fromB= ref $from eq "SCALAR"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | $options{string} = $$from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ▶ | } elsif( ref $from and ref $from eq 'GLOB' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref $from and ref $from eq "GLOB"
MC/DC0%0/2
ref $from and ref $from eq "GLOB"
ref $from
ref $from eq "GLOB"
Truth table66%2/3
A and B
A= ref $fromB= ref $from eq "GLOB"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | $options{FD} = $from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ▶ | } elsif( blessed $from and $from->isa('XML::LibXML::Document') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
builtin::blessed($from) and $from->isa("XML::LibXML::Document")
MC/DC100%2/2
builtin::blessed($from) and $from->isa("XML::LibXML::Document")
builtin::blessed($from)
$from->isa("XML::LibXML::Document")
Truth table100%3/3
A and B
A= builtin::blessed($from)B= $from->isa("XML::LibXML::Document")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 1 | $options{DOM} = $from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ▶ | } elsif( blessed $from and $from->isa('XML::LibXML::Element') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
builtin::blessed($from) and $from->isa("XML::LibXML::Element")
MC/DC50%1/2
builtin::blessed($from) and $from->isa("XML::LibXML::Element")
builtin::blessed($from)
$from->isa("XML::LibXML::Element")
Truth table66%2/3
A and B
A= builtin::blessed($from)B= $from->isa("XML::LibXML::Element")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | my $doc = XML::LibXML->createDocument; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | $doc->setDocumentElement($from); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | $options{DOM} = $doc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } elsif( blessed $from ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $options{IO} = $from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } elsif( !ref $from ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 19 | $options{location} = $from; # filename or URL | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | } elsif( ! grep { $_ =~ /^(IO|string|location|FD|DOM)$/} keys %options ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | croak "invalid option 'from': $from"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | $from = XML::LibXML::Reader->new( %options ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | or die "failed to create XML::LibXML::Reader with " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 31 | ▶ | . join(', ',map { "$_=".$options{$_} } keys %options )."\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 40 | $self->stream($from); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | sub _trigger_ns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 5 | ▶ | my ($self, $ns) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_ns: called CC=4 SCAR=18.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 5 | ▶ | if (!defined $ns or $ns eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
not defined $ns or $ns eq ""
MC/DC0%0/2
not defined $ns or $ns eq ""
not defined $ns
$ns eq ""
Truth table33%1/3
not(A) or B
A= not defined $nsB= $ns eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $self->{ns} = 'keep'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } elsif ($ns !~ /^(keep|strip|disallow)?$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | croak "invalid option 'ns': $ns"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | sub _checkPath { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 48 | ▶ | my $path = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_checkPath: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 48 | ▶ | die "invalid path: $path" if $path =~ qr{\.\.|.//|^\.}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 48 | ▶ | die "relative path not supported: $path" if $path =~ qr{^[^/]+/}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 48 | return $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | sub _nameMatch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 77 | ▶ | return ($_[0] eq '*' or $_[0] eq $_[1]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_nameMatch: called CC=2 SCAR=6.9
Condition100%3/3
$_[0] eq '*' || $_[0] eq $_[1]
MC/DC100%2/2
$_[0] eq '*' || $_[0] eq $_[1]
$_[0] eq '*'
$_[0] eq $_[1]
Truth table100%3/3
A || B
A= $_[0] eq '*'B= $_[0] eq $_[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # read to the next element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # TODO: use XML::LibXML->nextPatternMatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | sub _nextPatternMatch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 62 | ▶ | my ($self, $stream, $path) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_nextPatternMatch: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 62 | $path =~ s{^//}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 62 | ▶ | $path .= '*' if $path =~ qr{^$|/$}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 62 | my @parts = split '/', $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 62 | my $relative = $parts[0] ne ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 62 | while(1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 151 | ▶ | return if !$stream->read; # end or error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 135 | ▶ | next if $stream->nodeType != XML_READER_TYPE_ELEMENT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # printf " %d=%d %s:%s==%s\n", $stream->depth, scalar @parts, $stream->nodePath, $stream->name, join('/', @parts); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 77 | my $name = $self->_name($stream); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 77 | ▶ | if ($relative) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 49 | ▶ | if (_nameMatch($parts[0], $name)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 33 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 28 | ▶ | if (!_nameMatch($parts[$stream->depth+1], $name)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 6 | $stream->nextSibling(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } elsif ($stream->depth == scalar @parts - 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 13 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 46 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | sub readNext { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 62 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readNext: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 62 | ▶ | my $stream = blessed $_[0] ? shift() : $self->stream; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 62 | ▶ | my $path = defined $_[0] ? _checkPath($_[0]) : $self->path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 62 | ▶ | return unless $self->_nextPatternMatch($stream, $path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 46 | my $xml = $self->readElement($stream); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 44 | ▶ | return $self->simple ? XML::Struct::Simple->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | root => $self->root, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | attributes => $self->attributes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | depth => $self->depth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | content => $self->content, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | )->transform($xml) : $xml; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 5 | *read = \&readNext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | sub readDocument { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 30 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readDocument: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 30 | my @document; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 30 | ▶ | while(my $element = $self->read(@_)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 30 | ▶ | return $element unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 14 | push @document, $element; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 12 | return @document; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | sub _name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 287 | ▶ | my ($self, $stream) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_name: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 287 | ▶ | if ($self->ns eq 'strip') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 10 | return $stream->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } elsif( $self->ns eq 'disallow' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 15 | ▶ | if ( $stream->name =~ /^xmlns(:.*)?$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 2 | croak "namespaces not allowed at line ".$stream->lineNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 275 | return $stream->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | sub readElement { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 182 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readElement: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 182 | ▶ | my $stream = @_ ? shift : $self->stream; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 182 | my @element = ($self->_name($stream)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # TODO: dom or raw | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 182 | ▶ | if (defined $self->depth and $stream->depth >= $self->depth) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->depth and $stream->depth >= $self->depth
MC/DC100%2/2
defined $self->depth and $stream->depth >= $self->depth
defined $self->depth
$stream->depth >= $self->depth
Truth table100%3/3
A and B
A= defined $self->depthB= $stream->depth >= $self->depth
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 28 | ▶ | if ($self->deep eq 'dom') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | my $dom = $stream->copyCurrentNode(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 1 | $stream->next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | return $dom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } elsif ($self->deep eq 'raw') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 1 | my $xml = $stream->readOuterXml(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 1 | $stream->next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | return $xml; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | #copyCurrentNode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | #if (defined $self->depth and $self->depth == $stream->depth ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | #print $stream->depth." ".$self->deep."!".$element[0]."\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 180 | ▶ | if ($self->attributes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 130 | my $attr = $self->readAttributes($stream); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 128 | ▶ | my $children = $stream->isEmptyElement ? [ ] : $self->readContent($stream); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 128 | push @element, $attr, $children; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } elsif( !$stream->isEmptyElement ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 38 | push @element, $self->readContent($stream); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 178 | return \@element; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | sub readAttributes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 130 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readAttributes: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 130 | ▶ | my $stream = @_ ? shift : $self->stream; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 130 | ▶ | return { } if $stream->moveToFirstAttribute != 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 26 | my $attr = { }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 26 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 30 | ▶ | if ($self->ns ne 'strip' or $stream->name !~ /^xmlns(:.*)?$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->ns ne "strip" or not $stream->name =~ /^xmlns(:.*)?$/
MC/DC100%2/2
$self->ns ne "strip" or not $stream->name =~ /^xmlns(:.*)?$/
$self->ns ne "strip"
not $stream->name =~ /^xmlns(:.*)?$/
Truth table100%3/3
A or not(B)
A= $self->ns ne "strip"B= not $stream->name =~ /^xmlns(:.*)?$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 28 | $attr->{ $self->_name($stream) } = $stream->value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } while ($stream->moveToNextAttribute); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 24 | $stream->moveToElement; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 24 | return $attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | sub readContent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 135 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readContent: called CC=9 SCAR=22.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 135 | ▶ | my $stream = @_ ? shift : $self->stream; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 135 | my @children; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 135 | while(1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 503 | $stream->read; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 503 | my $type = $stream->nodeType; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 503 | ▶ | last if !$type or $type == XML_READER_TYPE_END_ELEMENT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $type or $type == 15
MC/DC50%1/2
not $type or $type == 15
not $type
$type == 15
Truth table66%2/3
not(A) or B
A= not $typeB= $type == 15
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 368 | ▶ | if ($type == XML_READER_TYPE_ELEMENT) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 136 | push @children, $self->readElement($stream); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | ▶ | } elsif ($type == XML_READER_TYPE_TEXT or $type == XML_READER_TYPE_CDATA ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$type == 3 or $type == 4
MC/DC100%2/2
$type == 3 or $type == 4
$type == 3
$type == 4
Truth table100%3/3
A or B
A= $type == 3B= $type == 4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 60 | push @children, $stream->value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | ▶ | } elsif ($type == XML_READER_TYPE_SIGNIFICANT_WHITESPACE && $self->whitespace) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$type == 14 and $self->whitespace
MC/DC50%1/2
$type == 14 and $self->whitespace
$type == 14
$self->whitespace
Truth table66%2/3
A and B
A= $type == 14B= $self->whitespace
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 1 | push @children, $stream->value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 135 | return \@children; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||