| 1 | package XML::TreePuller; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 6 | our $VERSION = '0.1.2'; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Carp qw(croak carp); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use XML::LibXML::Reader; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use XML::TreePuller::Element; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 6 | ▶ | use XML::TreePuller::Constants; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 6 | our $NO_XS; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 6 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 18 | 6 | ▶ | if (! defined(eval { require XML::CompactTree::XS; })) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | 6 | $NO_XS = 1; | |||||||||||||||||||||||||||
| 20 | 6 | require XML::CompactTree; | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 6 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | 6 | my ($class, @args) = @_; | |||||||||||||||||||||||||||
| 27 | 6 | my $self = {}; | |||||||||||||||||||||||||||
| 28 | 6 | my $reader; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 6 | bless($self, $class); | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 6 | $self->{elements} = []; | |||||||||||||||||||||||||||
| 33 | 6 | $self->{config} = {}; | |||||||||||||||||||||||||||
| 34 | 6 | $self->{finished} = 0; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 6 | $Carp::CarpLevel++; | |||||||||||||||||||||||||||
| 37 | 6 | $reader = $self->{reader} = XML::LibXML::Reader->new(@args); | |||||||||||||||||||||||||||
| 38 | 6 | $Carp::CarpLevel--; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | #arg how do you get error messages out of libxml reader? | ||||||||||||||||||||||||||||
| 41 | 6 | ▶ | croak("could not construct libxml reader") unless defined $reader; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 6 | return $self; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 1 | ▶ | sub parse { | ||||||||||||||||||||||||||
|
Subroutine
parse: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | 1 | my ($class, @args) = @_; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 1 | return $class->new(@args)->next; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 7 | ▶ | sub iterate_at { | ||||||||||||||||||||||||||
|
Subroutine
iterate_at: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||
| 53 | 7 | my ($self, $path, $todo) = @_; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 7 | ▶ | croak("must specify match and instruction") unless defined $path && defined $todo; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $path and defined $todo
MC/DC0%0/2
defined $path and defined $todo
defined $path
defined $todo
Truth table33%1/3
A and B
A= defined $pathB= defined $todo
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 7 | $self->{config}->{$path} = $todo; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 7 | return undef; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub config { | ||||||||||||||||||||||||||
|
Subroutine
config: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 63 | #turn this warning on later | ||||||||||||||||||||||||||||
| 64 | #carp "config() is depreciated, use iterate_at() instead"; | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | return iterate_at(@_); | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 15 | ▶ | sub next { | ||||||||||||||||||||||||||
|
Subroutine
next: called CC=12 SCAR=25.1
Pod
documented
| |||||||||||||||||||||||||||||
| 70 | 15 | my ($self) = @_; | |||||||||||||||||||||||||||
| 71 | 15 | my $reader = $self->{reader}; | |||||||||||||||||||||||||||
| 72 | 15 | my $elements = $self->{elements}; | |||||||||||||||||||||||||||
| 73 | 15 | my $config = $self->{config}; | |||||||||||||||||||||||||||
| 74 | 15 | my $ret; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 15 | ▶ | return () if $self->{finished}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 15 | ▶ | if ($reader->nodeType != XML_READER_TYPE_ELEMENT) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 14 | ▶ | if (! $self->_find_next_element) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | #no more elements available in the document | ||||||||||||||||||||||||||||
| 81 | 2 | return (); | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | #the reader came in already sitting on an element so we have to | ||||||||||||||||||||||||||||
| 86 | #iterate at the end of the loop | ||||||||||||||||||||||||||||
| 87 | 13 | ▶ | do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 26 | my $path; | |||||||||||||||||||||||||||
| 89 | my $todo; | ||||||||||||||||||||||||||||
| 90 | 26 | my $ret; | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 26 | ▶ | if(! $self->_sync) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | #ran out of data in the document | ||||||||||||||||||||||||||||
| 94 | 0 | return (); | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 26 | push(@$elements, $reader->name); | |||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 26 | $path = '/' . join('/', @$elements); | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | #handle the default case where no config is specified | ||||||||||||||||||||||||||||
| 102 | 26 | ▶ | if (scalar(keys(%$config)) == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | 1 | $self->{finished} = 1; | |||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 1 | ▶ | if (wantarray()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | 0 | return($path, $self->_read_subtree); | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 1 | return $self->_read_subtree; | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | #if this is converted over a dispatch hash then | ||||||||||||||||||||||||||||
| 113 | #the keys in the hash can be used to validate items | ||||||||||||||||||||||||||||
| 114 | #as they are passed to next() and allow this | ||||||||||||||||||||||||||||
| 115 | #method to scale to more instructions | ||||||||||||||||||||||||||||
| 116 | 25 | ▶ | if (defined($todo = $config->{$path})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | 10 | ▶ | if ($todo eq 'short') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 118 | 6 | $ret = $self->_read_element; | |||||||||||||||||||||||||||
| 119 | } elsif ($todo eq 'subtree') { | ||||||||||||||||||||||||||||
| 120 | 4 | $ret = $self->_read_subtree; | |||||||||||||||||||||||||||
| 121 | } else { | ||||||||||||||||||||||||||||
| 122 | 0 | die "invalid todo specified: $todo"; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 10 | ▶ | if (wantarray()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | 5 | return($path, $ret); | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 5 | return $ret; | |||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | } while ($self->_find_next_element); | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 2 | return (); | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 2 | ▶ | sub reader { | ||||||||||||||||||||||||||
|
Subroutine
reader: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 138 | 2 | return $_[0]->{reader}; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | #private methods | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | #get the reader to a point where it is in sync with | ||||||||||||||||||||||||||||
| 144 | #our internal element list | ||||||||||||||||||||||||||||
| 145 | 26 | ▶ | sub _sync { | ||||||||||||||||||||||||||
|
Subroutine
_sync: called CC=4 SCAR=19.1
| |||||||||||||||||||||||||||||
| 146 | 26 | my ($self) = @_; | |||||||||||||||||||||||||||
| 147 | 26 | my $reader = $self->{reader}; | |||||||||||||||||||||||||||
| 148 | 26 | my $depth = $self->{reader}->depth; | |||||||||||||||||||||||||||
| 149 | 26 | my $elements = $self->{elements}; | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | #if we are at a higher level than we have | ||||||||||||||||||||||||||||
| 152 | #tracked to we need to get back to the same | ||||||||||||||||||||||||||||
| 153 | #depth as our element list to properly process | ||||||||||||||||||||||||||||
| 154 | #data again | ||||||||||||||||||||||||||||
| 155 | 26 | ▶ | while(scalar(@$elements) < $reader->depth) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | 0 | my $ret = $reader->nextElement; | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | if ($ret == -1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 159 | 0 | die "libxml read error"; | |||||||||||||||||||||||||||
| 160 | } elsif ($ret == 0) { | ||||||||||||||||||||||||||||
| 161 | 0 | $self->{finished} = 1; | |||||||||||||||||||||||||||
| 162 | 0 | return 0; | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | #handle the case where the reader is at a lower | ||||||||||||||||||||||||||||
| 167 | #depth than we have tracked to | ||||||||||||||||||||||||||||
| 168 | 26 | splice(@$elements, $reader->depth); | |||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 26 | return 1; | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 29 | ▶ | sub _find_next_element { | ||||||||||||||||||||||||||
|
Subroutine
_find_next_element: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||
| 175 | 29 | my ($self) = @_; | |||||||||||||||||||||||||||
| 176 | 29 | my $reader = $self->{reader}; | |||||||||||||||||||||||||||
| 177 | 29 | my $ret; | |||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 29 | ▶ | if (! ($ret = $reader->nextElement)) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 180 | 4 | $self->{finished} = 1; | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 4 | return 0; | |||||||||||||||||||||||||||
| 183 | } elsif ($ret == -1) { | ||||||||||||||||||||||||||||
| 184 | 0 | die "libxml read error"; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 25 | return 1; | |||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 5 | ▶ | sub _read_subtree { | ||||||||||||||||||||||||||
|
Subroutine
_read_subtree: called CC=2 SCAR=7.5
| |||||||||||||||||||||||||||||
| 191 | 5 | my ($self) = @_; | |||||||||||||||||||||||||||
| 192 | 5 | my $reader = $self->{reader}; | |||||||||||||||||||||||||||
| 193 | 5 | my $elements = $self->{elements}; | |||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 5 | my $tree = XML::TreePuller::Element->new(_read_tree($reader)); | |||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 5 | ▶ | if (! defined($tree)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 198 | 0 | $self->{finished} = 1; | |||||||||||||||||||||||||||
| 199 | 0 | return undef; | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 5 | return $tree; | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 6 | ▶ | sub _read_element { | ||||||||||||||||||||||||||
|
Subroutine
_read_element: called CC=13 SCAR=26.4
| |||||||||||||||||||||||||||||
| 206 | 6 | my ($self) = @_; | |||||||||||||||||||||||||||
| 207 | 6 | my $reader = $self->{reader}; | |||||||||||||||||||||||||||
| 208 | 6 | my $is_empty = $reader->isEmptyElement; | |||||||||||||||||||||||||||
| 209 | 6 | my $new; | |||||||||||||||||||||||||||
| 210 | my %attr; | ||||||||||||||||||||||||||||
| 211 | 6 | my $node_type; | |||||||||||||||||||||||||||
| 212 | 6 | my $ret; | |||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 6 | $new->[XML_TREEPULLER_ELEMENT_TYPE] = 1; | |||||||||||||||||||||||||||
| 215 | 6 | $new->[XML_TREEPULLER_ELEMENT_NAME] = $reader->name; | |||||||||||||||||||||||||||
| 216 | 6 | $new->[XML_TREEPULLER_ELEMENT_NAMESPACE] = 0; | |||||||||||||||||||||||||||
| 217 | 6 | $new->[XML_TREEPULLER_ELEMENT_ATTRIBUTES] = \%attr; | |||||||||||||||||||||||||||
| 218 | 6 | $new->[XML_TREEPULLER_ELEMENT_CHILDREN] = []; | |||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 6 | ▶ | if ($reader->hasAttributes && $reader->moveToFirstAttribute == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$reader->hasAttributes and $reader->moveToFirstAttribute == 1
MC/DC50%1/2
$reader->hasAttributes and $reader->moveToFirstAttribute == 1
$reader->hasAttributes
$reader->moveToFirstAttribute == 1
Truth table66%2/3
A and B
A= $reader->hasAttributesB= $reader->moveToFirstAttribute == 1
| |||||||||||||||||||||||||||||
| 222 | 4 | ▶ | do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | 4 | my $name = $reader->name; | |||||||||||||||||||||||||||
| 224 | 4 | my $val = $reader->value; | |||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 4 | $attr{$name} = $val; | |||||||||||||||||||||||||||
| 227 | } while($reader->moveToNextAttribute == 1); | ||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 6 | $ret = $reader->read; | |||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 6 | ▶ | if ($ret == -1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 234 | 0 | die "libxml read error"; | |||||||||||||||||||||||||||
| 235 | } elsif ($ret == 0) { | ||||||||||||||||||||||||||||
| 236 | 0 | return undef; | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | 6 | ▶ | if ($is_empty) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | 1 | return XML::TreePuller::Element->new($new); | |||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | 5 | $node_type = $reader->nodeType; | |||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 5 | ▶ | while($node_type != XML_READER_TYPE_ELEMENT && $node_type != XML_READER_TYPE_END_ELEMENT) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$node_type != 1 and $node_type != 15
MC/DC100%2/2
$node_type != 1 and $node_type != 15
$node_type != 1
$node_type != 15
Truth table100%3/3
A and B
A= $node_type != 1B= $node_type != 15
| |||||||||||||||||||||||||||||
| 246 | 7 | $node_type = $reader->nodeType; | |||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 7 | ▶ | if ($node_type == XML_READER_TYPE_TEXT || $node_type == XML_READER_TYPE_CDATA) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$node_type == 3 or $node_type == 4
MC/DC50%1/2
$node_type == 3 or $node_type == 4
$node_type == 3
$node_type == 4
Truth table66%2/3
A or B
A= $node_type == 3B= $node_type == 4
| |||||||||||||||||||||||||||||
| 249 | 4 | push(@{$new->[XML_TREEPULLER_ELEMENT_CHILDREN]}, [ $node_type, $reader->value ]); | |||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | 7 | $ret = $reader->read; | |||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 7 | ▶ | if ($ret == -1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 255 | 0 | die "libxml read error"; | |||||||||||||||||||||||||||
| 256 | } elsif ($ret == 0) { | ||||||||||||||||||||||||||||
| 257 | 0 | return undef; | |||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 7 | $node_type = $reader->nodeType; | |||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | 5 | return XML::TreePuller::Element->new($new); | |||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | 5 | ▶ | sub _read_tree { | ||||||||||||||||||||||||||
|
Subroutine
_read_tree: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||
| 268 | 5 | my ($r) = @_; | |||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | 5 | ▶ | if ($NO_XS) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 271 | 5 | return XML::CompactTree::readSubtreeToPerl($r, 0); | |||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | 0 | return XML::CompactTree::XS::readSubtreeToPerl($r, 0); | |||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | 6 | 1; | |||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | __END__ | ||||||||||||||||||||||||||||