Branch Coverage

blib/lib/XML/Smart/Tree.pm
Criterion Covered Total %
branch 102 212 48.1


line true false branch
45 0 137 if $XML::Smart::Tree::NO_XML_PARSER
50 137 0 if ($@)
63 0 0 if (not $tree or ref $tree ne 'ARRAY')
64 0 0 if ($$tree[1][2][0]{'arg1'} eq 't1')
78 0 133 if ($@)
91 0 4 if ($@)
106 144 129 if ($parser)
110 14 130 if ($parser =~ /^(?:html?|wild)$/i) { }
4 126 elsif ($parser =~ /^(?:re|smart)/i) { }
114 144 110 if ($Key =~ /^$parser$/i)
119 4 269 if ($module and $module eq 'XML_Parser') { }
118 151 elsif ($module and $module eq 'XML_Smart_Parser') { }
22 258 elsif ($module and $module eq 'XML_Smart_HTMLParser') { }
120 0 4 if &load_XML_Parser()
123 0 118 if not $PARSERS{'XML_Smart_Parser'} and &load_XML_Smart_Parser()
126 4 18 if not $PARSERS{'XML_Smart_HTMLParser'} and &load_XML_Smart_HTMLParser()
130 133 0 unless ($ok or $DEFAULT_LOADED)
131 0 133 if &load_XML_Parser()
133 133 0 unless ($PARSERS{'XML_Parser'})
134 133 0 if &load_XML_Smart_Parser()
155 0 185 if (ref $_[0] eq 'GLOB') { }
0 185 elsif ($_[0] =~ m[^http://\w+[^\r\n]+$]s) { }
185 0 elsif ($_[0] =~ /<.*?>/s) { }
159 0 0 unless open $fh, $_[0]
162 0 185 if ($fh)
165 0 0 if $open
169 0 185 unless ($data =~ /<.*?>/s)
171 0 185 unless ($module and $PARSERS{$module})
172 0 0 if (not $XML::Smart::Tree::NO_XML_PARSER and $INC{'XML/Parser.pm'} and $PARSERS{'XML_Parser'}) { }
0 0 elsif ($PARSERS{'XML_Smart_Parser'}) { }
177 0 185 if ($module eq 'XML_Parser') { }
163 22 elsif ($module eq 'XML_Smart_Parser') { }
22 0 elsif ($module eq 'XML_Smart_HTMLParser') { }
183 185 0 if ($_[0] and $_[0] =~ /^\s*(?:XML_\w+|html?|re\w+|smart)\s*$/i)
189 2 183 if ($args{'lowtag'})
190 0 185 if ($args{'upertag'})
191 2 183 if ($args{'lowarg'})
192 0 185 if ($args{'uperarg'})
193 0 185 if ($args{'arg_single'})
195 0 185 if ($args{'no_order'})
196 0 185 if ($args{'no_nodes'})
198 0 185 if ($args{'use_spaces'})
200 0 185 if ref $args{'on_start'} eq 'CODE'
201 0 185 if ref $args{'on_char'} eq 'CODE'
202 0 185 if ref $args{'on_end'} eq 'CODE'
215 0 185 if $@
252 0 0 unless $data[$index] eq '<' or $data[$index] eq '>'
255 0 0 if ($data[$index] eq '<') { }
0 0 elsif ($data[$index] eq '>') { }
257 0 0 if $state_machine{'in_cdata_block'}
262 0 0 if ($possible_cdata_block eq '
272 0 0 if $state_machine{'need_to_cdata_this'}
274 0 0 unless ($state_machine{'seen_some_tag'})
280 0 0 if ($state_machine{'tag_balance'} == 1)
295 0 0 if ($state_machine{'in_cdata_block'})
298 0 0 if ($possible_cdata_close eq ']]>')
307 0 0 unless ($state_machine{'seen_some_tag'})
314 0 0 unless ($state_machine{'tag_balance'})
365 0 0 if ($res->is_success) { }
375 0 0 if ($PARSERS{$Key})
403 606 284 if ($$this{'LAST_CALL'} and $$this{'LAST_CALL'} eq 'char')
415 10 880 if ($$this{'SMART'}{'tag'} and $$this{'SMART'}{'tag'} == 1) { }
0 1760 elsif ($$this{'SMART'}{'tag'} and $$this{'SMART'}{'tag'} == 2) { }
418 890 0 unless $$this{'SMART'}{'no_nodes'}
420 890 0 unless $$this{'SMART'}{'no_order'}
422 10 880 if ($$this{'SMART'}{'arg'})
427 0 0 if ($type == 1) { }
0 0 elsif ($type == 2) { }
430 0 0 if (exists $argsok{$k}) { }
431 0 0 if (ref $argsok{$k} ne 'ARRAY')
443 0 890 if ($$this{'SMART'}{'arg_single'})
445 0 0 unless defined $args{$Key}
450 890 0 unless ($$this{'SMART'}{'no_order'})
454 10 880 if ($$this{'SMART'}{'arg'})
457 0 0 if ($type == 1) { }
0 0 elsif ($type == 2) { }
462 377 513 if @order
468 890 0 if ($$this{'NOENTITY'})
472 282 608 if (defined $$this{'PARSING'}{'p'}{$tag}) { }
473 187 95 if (ref $$this{'PARSING'}{'p'}{$tag} ne 'ARRAY')
490 0 890 if ($$this{'SMART'}{'on_start'})
520 835 391 unless ($$this{'SMART'}{'use_spaces'} or $content =~ /\S+/s)
524 0 391 if (not defined $$this{'PARSING'}{'p'}{'dt:dt'} and defined $$this{'PARSING'}{'p'}{'DT:DT'})
528 16 375 if ($$this{'PARSING'}{'p'}{'dt:dt'} and $$this{'PARSING'}{'p'}{'dt:dt'} =~ /binary\.base64/is) { }
375 0 elsif ($$this{'NOENTITY'}) { }
533 0 16 if ($$this{'PARSING'}{'p'}{'/nodes'})
536 0 0 if ($nkeys < 1)
539 16 0 if ($$this{'PARSING'}{'p'}{'/order'})
542 0 16 if $order_i ne 'dt:dt'
543 0 16 if (@order_ok) { }
551 379 12 if (not exists $$this{'PARSING'}{'p'}{'CONTENT'}) { }
553 379 0 unless $$this{'SMART'}{'no_order'}
556 8 4 unless (tied $$this{'PARSING'}{'p'}{'CONTENT'})
567 8 0 if $key eq 'CONTENT'
571 8 0 unless $$this{'SMART'}{'no_order'}
576 12 0 unless $$this{'SMART'}{'no_order'}
579 0 391 if ($$this{'SMART'}{'on_char'})
594 620 270 if ($$this{'LAST_CALL'} eq 'char')
599 10 880 if ($$this{'SMART'}{'tag'} and $$this{'SMART'}{'tag'} == 1) { }
0 1760 elsif ($$this{'SMART'}{'tag'} and $$this{'SMART'}{'tag'} == 2) { }
602 0 890 if ($$this{'PARSING'}{'p'}{'/tag'} ne $tag)
611 0 890 if ($nkeys == 1 and exists $$this{'PARSING'}{'p'}{'CONTENT'})
612 0 0 if (ref $$back{$tag} eq 'ARRAY') { }
616 0 890 if ($$this{'PARSING'}{'p'}{'/nodes'} and not %{$$this{'PARSING'}{'p'}{'/nodes'};})
617 487 403 if ($$this{'PARSING'}{'p'}{'/order'} and $#{$$this{'PARSING'}{'p'}{'/order'};} <= 0)
621 0 890 if ($$this{'SMART'}{'on_end'})