| 1 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | package Data::ZPath::Node; | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 9 | ▶ | use B (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 9 | ▶ | use Scalar::Util qw(blessed refaddr reftype isdual); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 9 | our $VERSION = '0.001000'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2181 | ▶ | sub _created_as_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_created_as_string: called CC=4 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2181 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 2181 | ▶ | defined $value | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $value and not ref $value and not _is_bool($value)
defined $value and not ref $value
MC/DC0%0/3
defined $value and not ref $value and not _is_bool($value)
defined $value
not ref $value
not _is_bool($value)
Truth table25%1/4
A and not(B) and not(C)
A= defined $valueB= not ref $valueC= not _is_bool($value)
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | and not ref $value | ||||||||||||||||||||||||||||||||||||||||||
| 15 | and not _is_bool( $value ) | ||||||||||||||||||||||||||||||||||||||||||
| 16 | and not _created_as_number( $value ); | ||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 5518 | ▶ | sub _created_as_number { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_created_as_number: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 5518 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 5518 | ▶ | return !!0 unless defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 5518 | ▶ | return !!0 if ref $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 5518 | ▶ | return !!0 if utf8::is_utf8( $value ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 5434 | my $b_obj = B::svref_2object(\$value); | |||||||||||||||||||||||||||||||||||||||||
| 25 | 5434 | my $flags = $b_obj->FLAGS; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 5434 | ▶ | return !!1 if $flags & ( B::SVp_IOK() | B::SVp_NOK() ) and not( $flags & B::SVp_POK() ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$flags & 12288 and not $flags & 16384
MC/DC100%2/2
$flags & 12288 and not $flags & 16384
$flags & 12288
not $flags & 16384
Truth table100%3/3
A and not(B)
A= $flags & 12288B= not $flags & 16384
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 4278 | return !!0; | |||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 5615 | ▶ | sub _is_bool { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_bool: called CC=19 SCAR=34.6
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 5615 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 5615 | ▶ | my $ref = ref($value) || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
ref $value || ''
MC/DC100%1/1
ref $value || ''
ref $value
Truth table100%2/2
A
A= ref $value
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 5615 | ▶ | if ( $ref eq 'SCALAR' and defined $$value ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$ref eq "SCALAR" and defined $$value
MC/DC50%1/2
$ref eq "SCALAR" and defined $$value
$ref eq "SCALAR"
defined $$value
Truth table66%2/3
A and B
A= $ref eq "SCALAR"B= defined $$value
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | ▶ | return !!1 if $$value eq 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | ▶ | return !!1 if $$value eq 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 5614 | ▶ | if ( blessed($value) and $value->isa('Types::Serialiser::Boolean') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($value) and $value->isa("Types::Serialiser::Boolean")
MC/DC0%0/2
builtin::blessed($value) and $value->isa("Types::Serialiser::Boolean")
builtin::blessed($value)
$value->isa("Types::Serialiser::Boolean")
Truth table66%2/3
A and B
A= builtin::blessed($value)B= $value->isa("Types::Serialiser::Boolean")
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | return !!1; | |||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 5614 | ▶ | if ( blessed($value) and $value->isa('JSON::PP::Boolean') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($value) and $value->isa("JSON::PP::Boolean")
MC/DC50%1/2
builtin::blessed($value) and $value->isa("JSON::PP::Boolean")
builtin::blessed($value)
$value->isa("JSON::PP::Boolean")
Truth table66%2/3
A and B
A= builtin::blessed($value)B= $value->isa("JSON::PP::Boolean")
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 96 | return !!1; | |||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 5518 | ▶ | return !!0 unless defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 5518 | ▶ | return !!0 if $ref; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 5518 | ▶ | return !!0 unless isdual( $value ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 36 | ▶ | return !!1 if $value and "$value" eq '1' and $value + 0 == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$value and "$value" eq 1 and $value + 0 == 1
$value and "$value" eq 1
MC/DC0%0/3
$value and "$value" eq 1 and $value + 0 == 1
$value
"$value" eq 1
$value + 0 == 1
Truth table25%1/4
A and B and C
A= $valueB= "$value" eq 1C= $value + 0 == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 36 | ▶ | return !!1 if not $value and "$value" eq q'' and $value + 0 == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not $value and "$value" eq "" and $value + 0 == 0
not $value and "$value" eq ""
MC/DC0%0/3
not $value and "$value" eq "" and $value + 0 == 0
not $value
"$value" eq ""
$value + 0 == 0
Truth table25%1/4
not(A) and B and C
A= not $valueB= "$value" eq ""C= $value + 0 == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 36 | return !!0; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 424 | ▶ | sub from_root { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from_root: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 424 | my ( $class, $obj ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 424 | return $class->_wrap($obj); | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 10174 | ▶ | sub _wrap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_wrap: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 10174 | my ( $class, $obj, $parent, $key, $ix ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 10174 | ▶ | my $is_xml = blessed($obj) && $obj->isa('XML::LibXML::Node'); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
builtin::blessed($obj) && $obj->isa('XML::LibXML::Node')
MC/DC100%2/2
builtin::blessed($obj) && $obj->isa('XML::LibXML::Node')
builtin::blessed($obj)
$obj->isa('XML::LibXML::Node')
Truth table100%3/3
A && B
A= builtin::blessed($obj)B= $obj->isa('XML::LibXML::Node')
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 10174 | my $id; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 10174 | ▶ | if ( blessed($obj) && $obj->isa('XML::LibXML::Document') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($obj) and $obj->isa("XML::LibXML::Document")
MC/DC100%2/2
builtin::blessed($obj) and $obj->isa("XML::LibXML::Document")
builtin::blessed($obj)
$obj->isa("XML::LibXML::Document")
Truth table100%3/3
A and B
A= builtin::blessed($obj)B= $obj->isa("XML::LibXML::Document")
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 86 | $obj = $obj->documentElement; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 86 | $key = $obj->nodeName; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 86 | $is_xml = 1; | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 10174 | ▶ | if ( $is_xml ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 3565 | $id = 'xml:' . refaddr($obj); | |||||||||||||||||||||||||||||||||||||||||
| 74 | } elsif ( ref($obj) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 1806 | $id = 'ref:' . refaddr($obj); | |||||||||||||||||||||||||||||||||||||||||
| 76 | } elsif ( $parent ) { | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 3019 | my $pid = $parent->id; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 3019 | ▶ | $pid = 'root' unless defined $pid; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 3019 | ▶ | my $k = defined $key ? $key : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 3019 | $id = 'slot:' . $pid . ':' . $k; | |||||||||||||||||||||||||||||||||||||||||
| 81 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 82 | # primitive: no stable identity, but used as a value node (not deduped as a tree node) | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 1784 | $id = undef; | |||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 10174 | return bless { | |||||||||||||||||||||||||||||||||||||||||
| 87 | raw => $obj, | ||||||||||||||||||||||||||||||||||||||||||
| 88 | parent => $parent, | ||||||||||||||||||||||||||||||||||||||||||
| 89 | key => $key, | ||||||||||||||||||||||||||||||||||||||||||
| 90 | id => $id, | ||||||||||||||||||||||||||||||||||||||||||
| 91 | ix => $ix, | ||||||||||||||||||||||||||||||||||||||||||
| 92 | slot => undef, # coderef getter/setter for Perl scalar lvalue | ||||||||||||||||||||||||||||||||||||||||||
| 93 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 4643 | ▶ | sub raw { $_[0]{raw} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
raw: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 197 | ▶ | sub parent { $_[0]{parent} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parent: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 45 | ▶ | sub key { $_[0]{key} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
key: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 7220 | ▶ | sub id { $_[0]{id} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 28 | ▶ | sub ix { $_[0]{ix} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ix: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 3 | ▶ | sub index { $_[0]{ix} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
index: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 5 | ▶ | sub slot { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
slot: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 5 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 5 | return $self->{slot}; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 3020 | ▶ | sub with_slot { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
with_slot: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 3020 | my ( $self, $slot ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 3020 | $self->{slot} = $slot; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 3020 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 8380 | ▶ | sub type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=24 SCAR=33.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 8380 | my ( $self, $x ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 8380 | ▶ | $x = $self->{raw} if @_ == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 8380 | ▶ | if ( blessed($x) && $x->isa('CBOR::Free::Tagged') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("CBOR::Free::Tagged")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("CBOR::Free::Tagged")
builtin::blessed($x)
$x->isa("CBOR::Free::Tagged")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("CBOR::Free::Tagged")
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | return $self->type($x->[1]); | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 8378 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Namespace') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Namespace")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Namespace")
builtin::blessed($x)
$x->isa("XML::LibXML::Namespace")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Namespace")
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | return 'attr'; | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 8378 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Attr') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Attr")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Attr")
builtin::blessed($x)
$x->isa("XML::LibXML::Attr")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Attr")
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 27 | return 'attr'; | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 8351 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Text') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Text")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Text")
builtin::blessed($x)
$x->isa("XML::LibXML::Text")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Text")
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 1278 | return 'text'; | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 7073 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Element') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
builtin::blessed($x)
$x->isa("XML::LibXML::Element")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Element")
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 2137 | return 'element'; | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 4936 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Document') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Document")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Document")
builtin::blessed($x)
$x->isa("XML::LibXML::Document")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Document")
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | return 'document'; | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 4936 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Comment') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Comment")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Comment")
builtin::blessed($x)
$x->isa("XML::LibXML::Comment")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Comment")
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | return 'comment'; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 4936 | ▶ | if ( blessed($x) && $x->isa('Math::BigInt') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("Math::BigInt")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("Math::BigInt")
builtin::blessed($x)
$x->isa("Math::BigInt")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("Math::BigInt")
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | return 'number'; | |||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 4936 | ▶ | return 'null' unless defined $x; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 4835 | ▶ | return 'map' if ref($x) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 3963 | ▶ | return 'list' if ref($x) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 3434 | ▶ | return 'boolean' if _is_bool($x); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 3337 | ▶ | return 'number' if _created_as_number($x); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 2181 | ▶ | return 'string' if _created_as_string($x); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | return ref($x); | |||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | # Essentially returns raw, but normalizes booleans | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 459 | ▶ | sub value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value: called CC=13 SCAR=29.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 459 | my ( $self, $x ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 157 | 459 | ▶ | $x = $self->{raw} if @_ == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 459 | ▶ | if ( ref $x and reftype($x) and reftype($x) eq 'SCALAR' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
ref $x and builtin::reftype($x) and builtin::reftype($x) eq "SCALAR"
ref $x and builtin::reftype($x)
MC/DC66%2/3
ref $x and builtin::reftype($x) and builtin::reftype($x) eq "SCALAR"
ref $x
builtin::reftype($x)
builtin::reftype($x) eq "SCALAR"
Truth table75%3/4
A and B and C
A= ref $xB= builtin::reftype($x)C= builtin::reftype($x) eq "SCALAR"
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 103 | ▶ | return !!$$x if $x eq 0 || $x eq 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$x eq 0 or $x eq 1
MC/DC50%1/2
$x eq 0 or $x eq 1
$x eq 0
$x eq 1
Truth table66%2/3
A or B
A= $x eq 0B= $x eq 1
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 458 | ▶ | if ( blessed($x) and $x->isa('Types::Serialiser::Boolean') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("Types::Serialiser::Boolean")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("Types::Serialiser::Boolean")
builtin::blessed($x)
$x->isa("Types::Serialiser::Boolean")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("Types::Serialiser::Boolean")
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | return !!( $x ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 458 | ▶ | if ( blessed($x) and $x->isa('JSON::PP::Boolean') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("JSON::PP::Boolean")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("JSON::PP::Boolean")
builtin::blessed($x)
$x->isa("JSON::PP::Boolean")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("JSON::PP::Boolean")
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | return !!( $x ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 458 | return $x; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 1296 | ▶ | sub primitive_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primitive_value: called CC=30 SCAR=44.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 1296 | my ( $self, $x ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 1296 | ▶ | $x = $self->{raw} if @_ == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 1296 | ▶ | if ( blessed($x) && $x->isa('CBOR::Free::Tagged') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("CBOR::Free::Tagged")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("CBOR::Free::Tagged")
builtin::blessed($x)
$x->isa("CBOR::Free::Tagged")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("CBOR::Free::Tagged")
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | return $self->type($x->[1]); | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 1296 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Document') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Document")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Document")
builtin::blessed($x)
$x->isa("XML::LibXML::Document")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Document")
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $de = $x->documentElement; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | return defined($de) ? $de->textContent : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 1296 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Namespace') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Namespace")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Namespace")
builtin::blessed($x)
$x->isa("XML::LibXML::Namespace")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Namespace")
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | return $x->declaredURI // $x->nodeValue // ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
($x->declaredURI // $x->nodeValue) // ""
$x->declaredURI // $x->nodeValue
MC/DC0%0/2
($x->declaredURI // $x->nodeValue) // ""
$x->declaredURI
$x->nodeValue
Truth table0%0/3
A // B
A= $x->declaredURIB= $x->nodeValue
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 1296 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Attr') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Attr")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Attr")
builtin::blessed($x)
$x->isa("XML::LibXML::Attr")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Attr")
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 4 | return $x->getValue; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 1292 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Element') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
builtin::blessed($x)
$x->isa("XML::LibXML::Element")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Element")
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 12 | return $x->textContent; | |||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 1280 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Text') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Text")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Text")
builtin::blessed($x)
$x->isa("XML::LibXML::Text")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Text")
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | return $x->data; | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 1280 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Comment') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Comment")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Comment")
builtin::blessed($x)
$x->isa("XML::LibXML::Comment")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Comment")
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | return $x->data; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 1280 | ▶ | if ( ref $x and reftype($x) and reftype($x) eq 'SCALAR' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
ref $x and builtin::reftype($x) and builtin::reftype($x) eq "SCALAR"
ref $x and builtin::reftype($x)
MC/DC66%2/3
ref $x and builtin::reftype($x) and builtin::reftype($x) eq "SCALAR"
ref $x
builtin::reftype($x)
builtin::reftype($x) eq "SCALAR"
Truth table75%3/4
A and B and C
A= ref $xB= builtin::reftype($x)C= builtin::reftype($x) eq "SCALAR"
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | ▶ | return !!$$x if $x eq 0 || $x eq 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$x eq 0 or $x eq 1
MC/DC0%0/2
$x eq 0 or $x eq 1
$x eq 0
$x eq 1
Truth table33%1/3
A or B
A= $x eq 0B= $x eq 1
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 1280 | ▶ | if ( blessed($x) and $x->isa('Types::Serialiser::Boolean') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("Types::Serialiser::Boolean")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("Types::Serialiser::Boolean")
builtin::blessed($x)
$x->isa("Types::Serialiser::Boolean")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("Types::Serialiser::Boolean")
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | return !!( $x ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 1280 | ▶ | if ( blessed($x) and $x->isa('JSON::PP::Boolean') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("JSON::PP::Boolean")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("JSON::PP::Boolean")
builtin::blessed($x)
$x->isa("JSON::PP::Boolean")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("JSON::PP::Boolean")
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | return !!( $x ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | 1280 | return $x; | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | 465 | ▶ | sub string_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
string_value: called CC=20 SCAR=32.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 465 | my ( $self, $x ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 217 | 465 | ▶ | $x = $self->{raw} if @_ == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | 465 | ▶ | if ( blessed($x) && $x->isa('CBOR::Free::Tagged') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("CBOR::Free::Tagged")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("CBOR::Free::Tagged")
builtin::blessed($x)
$x->isa("CBOR::Free::Tagged")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("CBOR::Free::Tagged")
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | return $self->type($x->[1]); | |||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 465 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Document') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Document")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Document")
builtin::blessed($x)
$x->isa("XML::LibXML::Document")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Document")
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $de = $x->documentElement; | |||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | return defined($de) ? $de->textContent : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 465 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Namespace') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Namespace")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Namespace")
builtin::blessed($x)
$x->isa("XML::LibXML::Namespace")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Namespace")
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 1 | ▶ | return $x->declaredURI // $x->nodeValue // ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
($x->declaredURI // $x->nodeValue) // ""
$x->declaredURI // $x->nodeValue
MC/DC0%0/2
($x->declaredURI // $x->nodeValue) // ""
$x->declaredURI
$x->nodeValue
Truth table33%1/3
A // B
A= $x->declaredURIB= $x->nodeValue
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 464 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Attr') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Attr")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Attr")
builtin::blessed($x)
$x->isa("XML::LibXML::Attr")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Attr")
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 48 | return $x->getValue; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 416 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Element') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
builtin::blessed($x)
$x->isa("XML::LibXML::Element")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Element")
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 73 | return $x->textContent; | |||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | 343 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Text') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Text")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Text")
builtin::blessed($x)
$x->isa("XML::LibXML::Text")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Text")
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 10 | return $x->data; | |||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 333 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Comment') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Comment")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Comment")
builtin::blessed($x)
$x->isa("XML::LibXML::Comment")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Comment")
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | return $x->data; | |||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 333 | my $v = $self->primitive_value; | |||||||||||||||||||||||||||||||||||||||||
| 244 | 333 | ▶ | return undef unless defined $v; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 332 | return "$v"; | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 263 | ▶ | sub number_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
number_value: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 263 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 263 | my $v = $self->primitive_value; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 263 | ▶ | return undef unless defined $v && Scalar::Util::looks_like_number($v); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $v and &Scalar::Util::looks_like_number($v)
MC/DC50%1/2
defined $v and &Scalar::Util::looks_like_number($v)
defined $v
&Scalar::Util::looks_like_number($v)
Truth table66%2/3
A and B
A= defined $vB= &Scalar::Util::looks_like_number($v)
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 262 | ▶ | if ( $Data::ZPath::UseBigInt and $v =~ /\A-?[0-9]{19,}\z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$Data::ZPath::UseBigInt and $v =~ /\A-?[0-9]{19,}\z/
MC/DC100%2/2
$Data::ZPath::UseBigInt and $v =~ /\A-?[0-9]{19,}\z/
$Data::ZPath::UseBigInt
$v =~ /\A-?[0-9]{19,}\z/
Truth table100%3/3
A and B
A= $Data::ZPath::UseBigIntB= $v =~ /\A-?[0-9]{19,}\z/
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 10 | require Math::BigInt; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 10 | return Math::BigInt->from_dec($v); | |||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 252 | return 0 + $v; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 6790 | ▶ | sub children { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
children: called CC=14 SCAR=27.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 6790 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 263 | 6790 | my $x = $self->{raw}; | |||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | # XML document: treat documentElement as child | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 6790 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Document') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Document")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Document")
builtin::blessed($x)
$x->isa("XML::LibXML::Document")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Document")
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my $de = $x->documentElement; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | return unless $de; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | return Data::ZPath::Node->_wrap($de, $self, 0); | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 6790 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Element') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
builtin::blessed($x)
$x->isa("XML::LibXML::Element")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Element")
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 1975 | ▶ | my @kids = $Data::ZPath::XmlIgnoreWS ? $x->nonBlankChildNodes : $x->childNodes; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 1975 | my %count; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 1975 | ▶ | return map { Data::ZPath::Node->_wrap($_, $self, $_->nodeName, $count{$_->nodeName}++ || 0) } @kids; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$count{$_->nodeName}++ || 0
MC/DC100%1/1
$count{$_->nodeName}++ || 0
$count{$_->nodeName}++
Truth table100%2/2
A
A= $count{$_->nodeName}++
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | 4815 | ▶ | if ( ref($x) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | 831 | my @out; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 831 | for my $k (keys %$x) { | |||||||||||||||||||||||||||||||||||||||||
| 281 | 3240 | my $child = Data::ZPath::Node->_wrap($x->{$k}, $self, $k); | |||||||||||||||||||||||||||||||||||||||||
| 282 | 5 | ▶ | $child->with_slot(sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 5 | ▶ | if ( @_ ) { $x->{$k} = $_[0]; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 5 | return $x->{$k}; | |||||||||||||||||||||||||||||||||||||||||
| 285 | 3240 | ▶ | }) unless ref($x->{$k}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 3240 | push @out, $child; | |||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 831 | return @out; | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 3984 | ▶ | if ( ref($x) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 403 | my @out; | |||||||||||||||||||||||||||||||||||||||||
| 293 | 403 | ▶ | for ( my $i = 0; $i < @$x; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 1272 | my $child = Data::ZPath::Node->_wrap($x->[$i], $self, $i, $i); | |||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | $child->with_slot(sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | if ( @_ ) { $x->[$i] = $_[0]; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | return $x->[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 298 | 1272 | ▶ | }) unless ref($x->[$i]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 1272 | push @out, $child; | |||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 403 | return @out; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 3581 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | 93 | ▶ | sub attributes { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attributes: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 93 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 309 | 93 | my $x = $self->{raw}; | |||||||||||||||||||||||||||||||||||||||||
| 310 | 93 | ▶ | return unless blessed($x) && $x->isa('XML::LibXML::Element'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
builtin::blessed($x)
$x->isa("XML::LibXML::Element")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Element")
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 54 | my @attrs = $x->attributes; | |||||||||||||||||||||||||||||||||||||||||
| 312 | 54 | return map { Data::ZPath::Node->_wrap($_, $self, '@' . $_->nodeName) } @attrs; | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 8534 | ▶ | sub name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 8534 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 317 | 8534 | my $x = $self->{raw}; | |||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 8534 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Attr') ) { return '@' . $x->nodeName; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($x) and $x->isa("XML::LibXML::Attr")
MC/DC0%0/2
builtin::blessed($x) and $x->isa("XML::LibXML::Attr")
builtin::blessed($x)
$x->isa("XML::LibXML::Attr")
Truth table66%2/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Attr")
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 8534 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Element') ) { return $x->nodeName; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Element")
builtin::blessed($x)
$x->isa("XML::LibXML::Element")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Element")
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 6425 | ▶ | if ( blessed($x) && $x->isa('XML::LibXML::Text') ) { return '#text'; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($x) and $x->isa("XML::LibXML::Text")
MC/DC100%2/2
builtin::blessed($x) and $x->isa("XML::LibXML::Text")
builtin::blessed($x)
$x->isa("XML::LibXML::Text")
Truth table100%3/3
A and B
A= builtin::blessed($x)B= $x->isa("XML::LibXML::Text")
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | 5363 | return $self->{key}; | |||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 2 | ▶ | sub dump { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 2 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 328 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 329 | 2 | '@type' => $self->type, | |||||||||||||||||||||||||||||||||||||||||
| 330 | '@id' => $self->id, | ||||||||||||||||||||||||||||||||||||||||||
| 331 | '@key' => $self->key, | ||||||||||||||||||||||||||||||||||||||||||
| 332 | '@index' => $self->index, | ||||||||||||||||||||||||||||||||||||||||||
| 333 | '@value' => $self->primitive_value, | ||||||||||||||||||||||||||||||||||||||||||
| 334 | children => [ map $_->dump, $self->children ], | ||||||||||||||||||||||||||||||||||||||||||
| 335 | attributes => [ map $_->dump, $self->attributes ], | ||||||||||||||||||||||||||||||||||||||||||
| 336 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 5 | ▶ | sub find { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 5 | require Data::ZPath; | |||||||||||||||||||||||||||||||||||||||||
| 341 | 5 | my ( $self, $zpath ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 5 | ▶ | $zpath = Data::ZPath->new( $zpath ) unless blessed($zpath); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 5 | return $zpath->evaluate( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | __END__ | ||||||||||||||||||||||||||||||||||||||||||