| 1 | package MDOM::Rule::Simple; | ||||||||||||||||||||||
| 2 | |||||||||||||||||||||||
| 3 | 16 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 4 | 16 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 5 | |||||||||||||||||||||||
| 6 | #use Smart::Comments; | ||||||||||||||||||||||
| 7 | 16 | ▶ | use base 'MDOM::Rule'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 8 | 16 | ▶ | use MDOM::Util qw( trim_tokens ); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 9 | |||||||||||||||||||||||
| 10 | sub targets { | ||||||||||||||||||||||
| 11 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||||
|
Subroutine
targets: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||
| 12 | 6 | ▶ | $self->_parse if !$self->{colon}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 13 | 6 | my $tokens = $self->{targets}; | |||||||||||||||||||||
| 14 | 6 | ▶ | wantarray ? @$tokens : $tokens; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||
| 16 | |||||||||||||||||||||||
| 17 | sub normal_prereqs { | ||||||||||||||||||||||
| 18 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||||
|
Subroutine
normal_prereqs: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||
| 19 | 6 | ▶ | $self->_parse if !$self->{colon}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 20 | 6 | my $tokens = $self->{normal_prereqs}; | |||||||||||||||||||||
| 21 | 6 | ▶ | wantarray ? @$tokens : $tokens; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||
| 23 | |||||||||||||||||||||||
| 24 | sub order_prereqs { | ||||||||||||||||||||||
| 25 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||
|
Subroutine
order_prereqs: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||
| 26 | 0 | ▶ | $self->_parse if !$self->{colon}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 27 | 0 | my $tokens = $self->{order_prereqs}; | |||||||||||||||||||||
| 28 | 0 | ▶ | wantarray ? @$tokens : $tokens; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||
| 30 | sub colon { | ||||||||||||||||||||||
| 31 | 3 | ▶ | my ($self) = @_; | ||||||||||||||||||||
|
Subroutine
colon: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||
| 32 | 3 | ▶ | $self->_parse if !$self->{colon}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 33 | 3 | $self->{colon}; | |||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||
| 35 | |||||||||||||||||||||||
| 36 | sub command { | ||||||||||||||||||||||
| 37 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||
|
Subroutine
command: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||
| 38 | 0 | ▶ | $self->_parse if !$self->{colon}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 39 | 0 | $self->{command}; | |||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||
| 41 | |||||||||||||||||||||||
| 42 | sub _parse { | ||||||||||||||||||||||
| 43 | 3 | ▶ | my ($self) = @_; | ||||||||||||||||||||
|
Subroutine
_parse: called CC=8 SCAR=21.2
| |||||||||||||||||||||||
| 44 | 3 | my @elems = $self->elements; | |||||||||||||||||||||
| 45 | 3 | my (@targets, $colon, @normal_prereqs, @order_prereqs, $command); | |||||||||||||||||||||
| 46 | 3 | my $prereqs = \@normal_prereqs; | |||||||||||||||||||||
| 47 | ## @elems | ||||||||||||||||||||||
| 48 | 3 | for my $elem (@elems) { | |||||||||||||||||||||
| 49 | 34 | ▶ | if (!$colon) { | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 50 | 12 | ▶ | if ($elem->class eq 'MDOM::Token::Separator') { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 51 | 3 | $colon = $elem->content; | |||||||||||||||||||||
| 52 | } else { | ||||||||||||||||||||||
| 53 | 9 | push @targets, $elem; | |||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||
| 55 | } elsif ($elem->class eq 'MDOM::Token::Comment') { | ||||||||||||||||||||||
| 56 | 1 | last; | |||||||||||||||||||||
| 57 | } elsif ($elem->class eq 'MDOM::Command') { | ||||||||||||||||||||||
| 58 | 0 | $command = $elem; | |||||||||||||||||||||
| 59 | 0 | last; | |||||||||||||||||||||
| 60 | ▶ | } elsif ($elem->class eq 'MDOM::Token::Bare' and | |||||||||||||||||||||
|
Condition66%2/3
$elem->class eq "MDOM::Token::Bare" and $elem->content eq "|"
MC/DC0%0/2
$elem->class eq "MDOM::Token::Bare" and $elem->content eq "|"
$elem->class eq "MDOM::Token::Bare"
$elem->content eq "|"
Truth table66%2/3
A and B
A= $elem->class eq "MDOM::Token::Bare"B= $elem->content eq "|"
| |||||||||||||||||||||||
| 61 | $elem->content eq '|') { | ||||||||||||||||||||||
| 62 | 0 | $prereqs = \@order_prereqs; | |||||||||||||||||||||
| 63 | } else { | ||||||||||||||||||||||
| 64 | 21 | push @$prereqs, $elem; | |||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||
| 67 | 3 | trim_tokens(\@targets); | |||||||||||||||||||||
| 68 | 3 | trim_tokens(\@normal_prereqs); | |||||||||||||||||||||
| 69 | 3 | trim_tokens(\@order_prereqs); | |||||||||||||||||||||
| 70 | 3 | $self->{targets} = \@targets; | |||||||||||||||||||||
| 71 | 3 | $self->{colon} = $colon; | |||||||||||||||||||||
| 72 | 3 | $self->{normal_prereqs} = \@normal_prereqs; | |||||||||||||||||||||
| 73 | 3 | $self->{order_prereqs} = \@order_prereqs; | |||||||||||||||||||||
| 74 | 3 | $self->{command} = $command; | |||||||||||||||||||||
| 75 | ### $self | ||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||
| 77 | |||||||||||||||||||||||
| 78 | 16 | 1; | |||||||||||||||||||||
| 79 | |||||||||||||||||||||||