Branch Coverage

blib/lib/Nice/Try.pm
Criterion Covered Total %
branch 222 406 54.6


line true false branch
47 25 0 unless exists $hash->{'debug'}
48 25 0 unless exists $hash->{'no_filter'}
49 25 0 unless exists $hash->{'debug_code'}
50 25 0 unless exists $hash->{'debug_dump'}
51 25 0 unless exists $hash->{'dont_want'}
55 0 25 if ($class->can("TIESCALAR") or $class->can("TIEHASH") or $class->can("TIEARRAY"))
60 0 25 overload::Overloaded($class) ? :
84 3 3 defined $n ? :
100 0 43 if ($self->{'no_filter'})
104 0 0 if $self->{'debug'} >= 3
110 0 2489 if ($status < 0)
112 0 0 if $self->{'debug'} >= 3
124 18 25 unless $line
125 25 0 unless ($status < 0)
131 0 25 if $self->{'debug'} >= 4
135 0 25 if $self->{'debug_dump'}
136 21 4 if ($doc = $self->_parse($doc)) { }
150 0 25 if (length $last_line)
155 0 25 unless ($status <= 0)
160 0 0 if $status < 0
165 0 25 if ($self->{'debug_file'})
167 0 0 if (open my $fh, ">$self->{'debug_file'}")
182 0 0 unless defined $code and length $code
183 0 0 unless (ref $self)
185 0 0 !(@_ % 2) ? :
0 0 ref $_[0] eq 'HASH' ? :
0 0 !(@_ && defined $_[0]) ? :
201 0 0 if $self->{'debug'} >= 4
203 0 0 if $self->{'debug_dump'}
204 0 0 if ($doc = $self->_parse($doc))
216 0 0 if ($self->{'debug'} >= 4)
221 0 0 unless $elem->children
225 0 0 if ($e->can("children") and $e->children)
235 0 0 if (@_)
237 0 0 ref $_ eq 'CODE' ? :
240 0 0 if warnings::enabled()
249 0 0 $_[0] =~ /^\d+$/ ? :
250 0 0 if $self->{'debug'} < $level
256 0 0 ref $_ eq 'CODE' ? :
265 96 0 $_[0] =~ /^\d+$/ ? :
266 96 0 if $self->{'debug'} < $level
275 0 0 if ref $_
278 0 0 ref $_ eq 'CODE' ? :
289 0 267 unless (&Scalar::Util::blessed($elem) and $elem->isa("PPI::Node"))
299 0 267 unless defined $ref
300 0 25 if $ref and ref $ref and $self->{'debug'} >= 4
301 242 25 unless $ref and scalar @$ref
307 0 25 if $self->{'debug'} >= 3
311 0 118 unless scalar @block_children
321 2 1536 if ($sib->class eq "PPI::Token::Word" and $sib->content eq "try")
325 2 0 if ($next and $next->class eq "PPI::Structure::Block")
327 0 2 if $self->{'debug'} >= 3
329 0 2 if $self->{'debug'} >= 3
337 0 118 if $self->{'debug'} >= 3
339 0 118 if $self->{'debug'} >= 3
341 2 116 if (scalar @$tmp_ref > 1) { }
347 0 4 if $self->{'debug'} >= 3
350 0 4 if $self->{'debug'} >= 4
357 8 49 if ($o->class eq 'PPI::Structure::Block' and $last_control) { }
11 38 elsif ($o->class eq 'PPI::Token::Word') { }
366 4 3 if ($ct eq "try" or $ct eq "catch" or $ct eq "finally")
385 4 21 if $o->class eq "PPI::Structure::Block" and &Scalar::Util::refaddr($o) eq &Scalar::Util::refaddr($last->{'block'})
388 0 4 if $self->{'debug'} >= 3
407 0 0 defined $last_obj ? :
0 0 defined $last_obj ? :
0 4 if $self->{'debug'} >= 3
408 0 4 if $self->{'debug'} >= 4
411 2 2 if ($last_obj->class eq 'PPI::Token::Whitespace') { }
420 0 4 if (not defined $rc) { }
0 4 elsif (not $rc) { }
431 4 0 if (scalar @$insignificants)
433 0 4 if $self->{'debug'} >= 4
436 0 21 if $self->{'debug'} >= 4
446 0 21 if ($@) { }
0 21 elsif (not defined $rc) { }
0 21 elsif (not $rc) { }
448 0 0 if (ref $o) { }
450 0 0 if $self->{'debug'}
454 0 0 if $self->{'debug'}
459 0 0 if $self->{'debug'}
463 0 0 if $self->{'debug'}
466 0 21 unless $o->parent
471 0 4 if length $err
483 0 25 if $self->{'debug'} >= 3
484 1 24 if scalar @$alt_ref > scalar @$ref
490 0 120 if $self->{'debug'} >= 5
508 5 115 unless scalar @block_children
521 296 1159 if (not scalar @$try_block_ref) { }
129 1030 elsif ($sib->class eq 'PPI::Token::Word' and $sib->content eq 'catch') { }
448 582 elsif ($inside_catch) { }
13 569 elsif ($sib->class eq 'PPI::Token::Word' and $sib->content eq 'finally') { }
27 542 elsif ($inside_finally) { }
189 353 elsif ($sib->class eq 'PPI::Token::Whitespace' and $sib->content =~ /[\015\012]+/) { }
524 113 183 if ($sib->class eq 'PPI::Structure::Block' and substr("$sib", 0, 1) eq '{' and substr("$sib", -1, 1) eq '}') { }
68 115 elsif ($sib->class eq 'PPI::Token::Whitespace' and $sib->content =~ /[\015\012]+/) { }
531 113 0 if (scalar @$buff)
555 125 4 if (scalar @$buff)
566 96 352 if ($sib->class eq 'PPI::Structure::List') { }
129 223 elsif ($sib->class eq 'PPI::Structure::Block') { }
87 136 elsif ($sib->class eq 'PPI::Token::Whitespace' and $sib->content =~ /[\015\012]+/) { }
574 24 105 if (scalar @$catch_def) { }
602 13 0 if (scalar @$buff)
613 0 27 if ($sib->class eq 'PPI::Structure::List') { }
13 14 elsif ($sib->class eq 'PPI::Structure::Block') { }
1 13 elsif ($sib->class eq 'PPI::Token::Whitespace' and $sib->content =~ /[\015\012]+/) { }
620 0 13 if (scalar @$fin_block_ref) { }
7 6 elsif (scalar @$catch_def) { }
669 105 10 scalar @$catch_def > 0 ? :
673 13 102 if (scalar @$fin_block_ref)
683 13 0 unless $self->{'debug_code'}
685 1 12 if ($fin_def->{'open_curly_nl'}) { }
693 0 13 if ($fin_def->{'close_curly_nl'}) { }
704 113 2 if (scalar @$try_block_ref) { }
719 3 110 if (my $emb = $self->_parse($try_def->{'block'}))
748 113 0 unless ($self->{'is_tied'} or $self->{'dont_want'} or $self->{'is_overloaded'})
855 113 0 unless $self->{'debug_code'}
857 68 45 if ($try_def->{'open_curly_nl'}) { }
865 103 10 if ($try_def->{'close_curly_nl'}) { }
875 8 105 if (not $has_catch_clause) { }
898 113 0 unless $self->{'debug_code'}
900 105 8 if (scalar @$catch_def) { }
911 1 128 if (my $emb = $self->_parse($cdef->{'block'}))
916 96 33 if ($cdef->{'var'}) { }
925 15 81 if ($str =~ /^(\S+)[[:blank:]\h\v]+(\$\S+)$/) { }
4 77 elsif ($str =~ /^(\S+)[[:blank:]\h\v]+(\$\S+)[[:blank:]\h\v]+where[[:blank:]\h\v]+\{(.*?)\}$/) { }
1 76 elsif ($str =~ /^(\$\S+)[[:blank:]\h\v]+where[[:blank:]\h\v]+\{(.*?)\}$/) { }
9 67 elsif ($str =~ /^(\$\S+)[[:blank:]\h\v]+isa[[:blank:]\h\v]+(\S+)(?:[[:blank:]\h\v]+where[[:blank:]\h\v]+\{(.*?)\})?$/) { }
2 65 elsif ($str =~ /^(?\$\S+)[[:blank:]\h\v]+isa[[:blank:]\h\v]*\([[:blank:]\h\v]*(?["'])?(?[^[:blank:]\h\v\'\"\)]+)\k{quote}[[:blank:]\h\v]*\)(?:[[:blank:]\h\v]+where[[:blank:]\h\v]+\{(?.*?)\})?$/) { }
955 129 0 if ($cdef->{'block'}) { }
965 105 24 if ($i == 0) { }
11 13 elsif ($i == $total_catch - 1) { }
974 2 9 $cdef->{'class'} ? :
0 11 $total_catch == 1 ? :
1061 96 33 if ($cdef->{'var'}) { }
1064 12 84 if ($cdef->{'class'} and $cdef->{'where'}) { }
18 66 elsif ($cdef->{'class'}) { }
1 65 elsif ($cdef->{'where'}) { }
1106 0 65 if (++$else > 1)
1109 0 0 if warnings::enabled()
1113 56 9 if $cond eq "if" or $cond eq "elsif"
1128 33 0 if $cond eq "if" or $cond eq "elsif"
1137 129 0 unless $self->{'debug_code'}
1139 87 42 if ($cdef->{'open_curly_nl'}) { }
1147 27 102 if ($cdef->{'close_curly_nl'}) { }
1160 65 40 if ($else) { }
1176 105 0 unless $self->{'debug_code'}
1198 8 0 unless $self->{'debug_code'}
1203 113 0 scalar @$catch_repl ? :
1204 113 0 if $catch_res
1209 7 106 if ($has_catch_clause and length $fin_block)
1221 113 0 unless $self->{'debug_code'}
1298 113 0 unless $self->{'debug_code'}
1326 113 0 unless $self->{'debug_code'}
1337 0 113 unless ($rc = $element_before_try->insert_after($token))
1343 0 0 defined $rc ? :
0 113 if $self->{'debug'} >= 3
1349 0 1293 unless $e->delete
1370 9 1419 unless $elem->children
1376 5 7072 if ($class eq "PPI::Token::Word" and $content =~ /^(?:CORE\::)?(?:GLOBAL\::)?caller$/)
1382 1173 5904 if ($e->can("elements") and $e->elements)
1397 8 1215 unless $elem->children
1398 0 1215 if $self->{'debug'} >= 5
1402 0 0 $e->can('elements') ? :
0 5998 if $self->{'debug'} >= 6
1405 0 5998 if ($class eq 'PPI::Structure::For' or $class eq 'PPI::Statement::Compound' and defined $e->first_element->content and $e->first_element->content =~ /^(for|foreach|while)$/) { }
0 5998 elsif ($class eq 'PPI::Token::Word' and $content =~ /^(?:CORE\::)?(?:GLOBAL\::)?(next|last|redo)$/) { }
82 5916 elsif ($class eq 'PPI::Statement::Break') { }
1415 0 0 if $self->{'debug'} >= 5
1423 0 0 if $self->{'debug'} >= 5
1426 0 0 if $self->{'debug'} >= 5
1431 0 82 if $self->{'debug'} >= 5
1432 82 0 scalar @$words ? :
1433 22 60 scalar @$words > 1 ? :
1434 0 82 if $self->{'debug'} >= 5
1435 0 82 if $self->{'debug'} >= 5 and scalar @$words > 1
1439 47 0 if (scalar @$words == 1 || scalar @$words > 1 && $word2 =~ /^(for|foreach|given|if|unless|until|while)$/ || $word1 eq 'return' and $word1 eq 'next' || $word1 eq 'last' || $word1 eq 'redo' || $word1 eq 'return')
1454 37 33 $word1 eq 'return' ? :
1457 10 60 if (scalar @$words > 1) { }
1466 0 70 if $self->{'debug'} >= 5
1472 0 70 if $self->{'debug'} >= 5
1474 0 70 if $self->{'debug'} >= 5
1485 981 4935 if ($e->can("elements") and $e->elements)
1513 6767 0 unless ($Token->isa("PPI::Token::HereDoc"))
1517 6767 0 unless ($heredoc ne "" and $content =~ /\n/)
1524 0 0 if ($content eq "\n") { }
1547 0 0 if ($Token->{'_damaged'})
1560 0 0 if ($tokens[$last_index]{'content'} =~ /^[^\n]*\n$/)
1568 0 0 if $tokens[$_]
1570 0 0 unless (defined $last_line)
1584 0 0 if $tokens[$_]->isa("PPI::Token::HereDoc")
1585 0 0 unless (defined $any_after)
1592 0 0 unless ($last_line and not $any_after)
1594 0 0 unless (defined $Token->{'_terminator_line'})
1600 0 0 unless ($Token->{'_terminator_line'} =~ /\n$/)
1607 0 0 if (defined $Token->{'_terminator_line'})
1614 0 351 if ($heredoc ne "")
1617 0 0 unless ($output =~ /\n$/)
1636 0 24 "$]" < 5.013002 ? :
1649 0 14 defined $catch_err ? :
1651 0 14 if defined $catch_err
1659 1 13 unless (eval { do { $@ = $err; &$code(@$args); 1 } })
1660 1 0 defined $@ ? :
1699 70 0 ref $_[0] ? :