| 1 | package Pod::Coverage::TrustMe::Parser; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 24 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 24 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 24 | our $VERSION = '0.002002'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 24 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 24 | ▶ | use Pod::Simple (); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 24 | our @ISA = qw(Pod::Simple); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 24 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 84 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 84 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 84 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 84 | $self->accept_targets_as_text('Pod::Coverage'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 84 | $self->{+__PACKAGE__} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 84 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 414 | ▶ | sub ignore_empty { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ignore_empty: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 414 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 414 | my $me = $self->{+__PACKAGE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 414 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | $me->{ignore_empty} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 414 | return $me->{ignore_empty}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 2476 | ▶ | sub _handle_element_start { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handle_element_start: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 2476 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 2476 | my $me = $self->{+__PACKAGE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 2476 | my ($name, $attr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 2476 | ▶ | if ($name eq 'for') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 9 | push @{ $me->{in} }, $attr; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ▶ | elsif ($name eq 'L' && $attr->{type} eq 'pod' && defined $attr->{to}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
$name eq "L" and $attr->{"type"} eq "pod" and defined $attr->{"to"}
$name eq "L" and $attr->{"type"} eq "pod"
MC/DC100%3/3
$name eq "L" and $attr->{"type"} eq "pod" and defined $attr->{"to"}
$name eq "L"
$attr->{"type"} eq "pod"
defined $attr->{"to"}
Truth table100%4/4
A and B and C
A= $name eq "L"B= $attr->{"type"} eq "pod"C= defined $attr->{"to"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 139 | my $to = "$attr->{to}"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 77 | push @{ $me->{links} }, $to | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 139 | ▶ | unless $me->{links_hash}{$to}++; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ▶ | elsif ($name eq 'item-text' || $name eq 'item-bullet' || $name =~ /\Ahead[2-9]\z/) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
$name eq "item-text" or $name eq "item-bullet" or $name =~ /\Ahead[2-9]\z/
$name eq "item-text" or $name eq "item-bullet"
MC/DC100%3/3
$name eq "item-text" or $name eq "item-bullet" or $name =~ /\Ahead[2-9]\z/
$name eq "item-text"
$name eq "item-bullet"
$name =~ /\Ahead[2-9]\z/
Truth table100%4/4
A or B or C
A= $name eq "item-text"B= $name eq "item-bullet"C= $name =~ /\Ahead[2-9]\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 413 | delete $me->{maybe_covered}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 413 | $me->{consider} = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 413 | $me->{consider_text} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | elsif ($name =~ /\Ahead1\z/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 157 | delete $me->{maybe_covered}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 2476 | $self->SUPER::_handle_element_start(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 2476 | ▶ | sub _handle_element_end { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handle_element_end: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 2476 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 2476 | my $me = $self->{+__PACKAGE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 2476 | my ($name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 2476 | ▶ | if ($name eq 'for') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 9 | pop @{ $self->{+__PACKAGE__}{in} }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ▶ | elsif ($name eq ($me->{consider}||'')) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$me->{'consider'} || ''
MC/DC100%1/1
$me->{'consider'} || ''
$me->{'consider'}
Truth table100%2/2
A
A= $me->{'consider'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 413 | delete $me->{consider}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 413 | my $text = delete $me->{consider_text}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 413 | my @covered = $text =~ /([^\s\|,\/]+)/g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 413 | for my $covered ( @covered ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # looks like a method | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 897 | $covered =~ s/.*->//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # looks fully qualified | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 897 | $covered =~ s/\A\w+(?:::\w+)*::(\w+)/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # looks like it includes parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 897 | $covered =~ s/(\w+)[;\(].*/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 413 | @covered = grep /\A\w+\z/, @covered; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 413 | ▶ | if ($self->ignore_empty) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | push @{ $me->{maybe_covered} }, @covered; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 411 | push @{ $me->{covered} }, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 411 | grep !$me->{covered_hash}{$_}++, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | @covered; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 2476 | $self->SUPER::_handle_element_end(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 2831 | ▶ | sub _handle_text { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handle_text: called CC=12 SCAR=26.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2831 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 2831 | my $me = $self->{+__PACKAGE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 2831 | my ($text) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2831 | my $in = $me->{in}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 2831 | ▶ | if ($in && @$in && $in->[-1]{target} =~ /\APod::Coverage(?:::Trust(?:Me|Pod))?\z/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition83%5/6
$in and @$in and $in->[-1]{"target"} =~ /\APod::Coverage(?:::Trust(?:Me|Pod))?\z/
$in and @$in
MC/DC66%2/3
$in and @$in and $in->[-1]{"target"} =~ /\APod::Coverage(?:::Trust(?:Me|Pod))?\z/
$in
@$in
$in->[-1]{"target"} =~ /\APod::Coverage(?:::Trust(?:Me|Pod))?\z/
Truth table75%3/4
A and B and C
A= $inB= @$inC= $in->[-1]{"target"} =~ /\APod::Coverage(?:::Trust(?:Me|Pod))?\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 10 | for my $token ($text =~ /(\S+)/g) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 11 | my $re; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 11 | ▶ | if ($token eq '*EVERYTHING*') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | $re = qr{.?}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 10 | $re = eval { qr{\A(?:$token)\z} }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 10 | ▶ | if (!$re) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | my $file = $self->{source_filename} || '<input>'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'source_filename'} || '<input>'
MC/DC0%0/1
$self->{'source_filename'} || '<input>'
$self->{'source_filename'}
Truth table0%0/2
A
A= $self->{'source_filename'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my $line = $in->[-1]{start_line} || '<unknown>'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$in->[-1]{'start_line'} || '<unknown>'
MC/DC0%0/1
$in->[-1]{'start_line'} || '<unknown>'
$in->[-1]{'start_line'}
Truth table0%0/2
A
A= $in->[-1]{'start_line'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | croak "Error compiling Pod::Coverage regex /$token/ at $file line $line: $@"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 11 | push @{ $me->{trusted} }, $re | |||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 11 | ▶ | unless $me->{trusted_hash}{$re}++; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | elsif ($me->{consider}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 545 | $me->{consider_text} .= $text; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | elsif ($me->{maybe_covered}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 1 | push @{ $me->{covered} }, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | grep !$me->{covered_hash}{$_}++, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | @{ delete $me->{maybe_covered} }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 2831 | $self->SUPER::_handle_text(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 11 | ▶ | sub links { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
links: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 11 | ▶ | return $self->{+__PACKAGE__}{links} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"Pod::Coverage::TrustMe::Parser"}{"links"} ||= []
MC/DC100%1/1
$self->{"Pod::Coverage::TrustMe::Parser"}{"links"} ||= []
$self->{"Pod::Coverage::TrustMe::Parser"}{"links"}
Truth table100%2/2
A
A= $self->{"Pod::Coverage::TrustMe::Parser"}{"links"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 28 | ▶ | sub trusted { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trusted: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 28 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 28 | ▶ | return $self->{+__PACKAGE__}{trusted} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"Pod::Coverage::TrustMe::Parser"}{"trusted"} ||= []
MC/DC100%1/1
$self->{"Pod::Coverage::TrustMe::Parser"}{"trusted"} ||= []
$self->{"Pod::Coverage::TrustMe::Parser"}{"trusted"}
Truth table100%2/2
A
A= $self->{"Pod::Coverage::TrustMe::Parser"}{"trusted"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 82 | ▶ | sub covered { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
covered: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 82 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 82 | ▶ | return $self->{+__PACKAGE__}{covered} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"Pod::Coverage::TrustMe::Parser"}{"covered"} ||= []
MC/DC100%1/1
$self->{"Pod::Coverage::TrustMe::Parser"}{"covered"} ||= []
$self->{"Pod::Coverage::TrustMe::Parser"}{"covered"}
Truth table100%2/2
A
A= $self->{"Pod::Coverage::TrustMe::Parser"}{"covered"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 24 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||