Workflow/Condition/Negated.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 100% 34 / 34 CC 2 SCAR 2.5
CC
2
Cov
100%
evaluate
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Workflow/Context.pm ↑ Summary Workflow/Persister/RandomId.pm »
1 package Workflow::Condition::Negated;
2  
3 29 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 29 ▶use v5.14.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 29 our $VERSION = '2.12';
8  
9 29 ▶use parent qw( Workflow::Condition );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 29 my @FIELDS = qw( name class negated );
12 29 __PACKAGE__->mk_accessors(@FIELDS);
13  
14 9 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
15 9 my ( $self, $params ) = @_;
16 9 my $negated = $params->{name};
17 9 $self->SUPER::init( $params );
18  
19 9 $negated =~ s/ \A ! //gx;
20 9 $self->negated( $negated );
21 }
22  
23 39 ▶sub evaluate {
Subroutine evaluate: called CC=2 SCAR=6.9
Pod documented
24 39 my ($self, $wf) = @_;
25 39 ▶ if ($self->evaluate_condition($wf, $self->negated)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->evaluate_condition($wf, $self->negated)) { } 12 26 38
26 12 return Workflow::Condition::IsFalse->new();
27 } else {
28 26 return Workflow::Condition::IsTrue->new();
29 }
30 }
31  
32  
33 29 1;
34  
35 __END__
« Workflow/Context.pm ↑ Summary Workflow/Persister/RandomId.pm »