Branch Coverage

blib/lib/XML/SAX/Machine.pm
Criterion Covered Total %
branch 115 218 52.7


line true false branch
33 17 46 @_ && ref $_[-1] eq 'HASH' ? :
42 6 41 if $$self{'Handler'}
52 0 239 if (ref $id)
57 58 181 if ($id =~ /^[+-]?\d+(?!\n)$/)
60 2 56 if $id > $#{$$self{'Parts'};} or $id < -($#{$$self{'Parts'};} + 1)
64 159 22 if exists $$self{'PartsByName'}{$id}
75 0 104 if $spec eq 'Exhaust'
79 6 98 if (0 <= index($spec, '/')) { }
82 0 6 unless 'File::Spec::Unix'->file_name_is_absolute($spec)
93 0 6 unless 'File::Spec::Unix'->file_name_is_absolute($spec)
101 0 9 unless ($part_rec)
113 0 104 unless $part_rec
120 0 104 unless defined $proc
124 0 104 unless ref $proc
128 0 104 unless index('SCALAR|ARRAY|HASH|Regexp|REF|CODE', ref $proc) <= 0
153 0 4 unless $fc eq uc $fc and $XML::SAX::Machine::AUTOLOAD =~ /$alpha_first_char/o
163 0 11 if @_
164 0 11 unless defined $$self{'Parts'}
174 0 0 if @_
175 0 0 unless defined $$self{'Parts'}
179 0 0 UNIVERSAL::can($proc, 'all_parts') ? :
188 0 0 if @_
189 0 0 unless defined $$self{'Parts'}
305 0 16 ref $_ ? :
6 9 if (grep((ref $_ ? $_ == $$self{$type} : $_ eq 'Exhaust'), @$hs))
306 5 1 if (@$hs == 1 and $proc->can('set_handler'))
307 0 5 $type ne 'Handler' ? :
314 0 1 unless ($proc->can('set_handlers'))
315 0 0 @$hs == 1 ? :
325 0 2 if (ref $_) { }
1 1 elsif ($_ eq 'Exhaust') { }
336 0 1 unless $h
354 0 0 unless (eval 'require Devel::TraceSAX; 1')
355 0 0 unless $warned_about_missing_sax_tracer++
360 0 0 @_ ? :
368 0 0 unless @_
376 0 0 if @_
378 0 0 unless (eval 'require Devel::TraceSAX; 1')
379 0 0 unless $warned_about_missing_sax_tracer++
388 0 0 if $$_{'Processor'}->can('trace_all_parts')
400 0 0 @_ ? :
480 1 106 unless defined $spec
483 1 105 unless length $spec
488 17 88 if ($type eq 'SCALAR' or $type eq 'GLOB' or UNIVERSAL::isa($spec, 'IO::Handle') or not $type and $spec =~ /^\s*([>|]|\+>)/) { }
49 39 elsif (not $type) { }
496 0 17 unless ($type)
499 0 0 unless open $fh, $spec
506 49 0 unless ($spec =~ /^\s*<|\|\s*(?!\n)$/)
513 2 47 unless $spec->can('new') or eval "require $spec"
517 3 36 if exists $basic_types{$type}
530 0 86 unless defined $prospect and length $prospect
533 76 10 $fc eq uc $fc && $prospect =~ /$is_name_like/o ? :
539 1 106 ref $_[0] ? :
564 0 100 unless defined $proc
570 75 25 if (defined $name)
571 2 73 if exists $$self{'PartsByName'}{$name}
574 1 74 unless _valid_name $name and $name ne 'Exhaust'
582 53 47 if ref $proc
589 126 4 ref $_ eq 'HASH' ? :
590 183 6 unless @names
594 5 1 if (@names == 1) { }
611 50 100 if $$self{'BuiltParts'}[$part_num]
613 0 100 if $$self{'SeenParts'}[$part_num]
641 3 74 if (ref $handler_spec) { }
646 2 1 if exists $$self{'PartsByProcessor'}{$handler_spec}
649 1 2 unless (defined $handler)
661 20 54 unless defined $handler
664 6 50 if ($$self{'SeenParts'}[$$handler{'Number'}])
667 1 5 $part eq $handler ? :
677 0 50 unless defined $handler_proc
681 0 50 unless ref $handler_proc
690 5 0 if ($$nested_cycle[-1] == $part) { }
705 0 100 unless defined $proc
709 47 53 if (not ref $proc) { }
13 40 elsif (@handler_procs) { }
714 0 47 if ($proc =~ /^\s*<|\|\s*(?!\n)$/) { }
15 32 elsif ('XML::SAX::Machines'->processor_class_option($proc, 'ConstructWithHashedOptions')) { }
724 0 0 unless open $fh, $proc
754 0 32 if @handler_procs > 1
765 0 13 if ($proc->can('set_handlers')) { }
13 0 elsif ($proc->can('set_handler')) { }
769 12 1 if (@handler_procs == 1) { }
790 1 99 if ($@)
818 93 14 ref $spec eq 'ARRAY' ? :
826 7 100 if ($@)
876 1 99 if ($@)
885 4 59 if (@{$$self{'DetectedCycles'};})
893 5 0 if $$cycle[$_]{'Number'} < $$cycle[$start]{'Number'}
917 16 47 if @errors
925 0 0 defined $a{$_} ? :
940 0 0 unless exists $ids{$_[0]}
951 0 0 if $h_spec eq 'Exhaust' and defined $$self{'Handler'}
956 0 0 unless $part_rec
960 0 0 if not $part_rec and defined $$options{'RootMachine'} and $h_spec != /^-?\d+$/
968 0 0 if ($part_rec) { }
975 0 0 if (ref $h_spec) { }
1001 0 0 unless $h
1006 0 0 if ($proc->can('generate_description')) { }
1043 0 0 ref $_[0] ? :
0 0 ref $_[0] eq 'HASH' ? :
0 0 @_ == 1 ? :
1053 0 0 unless $h
1055 0 0 unless ($$options{'Depth'})
1079 0 0 if (defined $$self{'Handler'})
1081 0 0 unless exists $$handler_elt{'Attributes'}{'Name'}
1092 0 0 if ($$self{'PartsByName'}{$_}{'Name'} ne $_)
1108 0 0 unless $$options{'Depth'}
1144 16 0 $$self{'Name'} ? :
16 0 $$self{'Processor'} ? :