| 1 | package Syccess::ValidatorSimple; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 7 | our $AUTHORITY = 'cpan:GETTY'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Syccess validator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | $Syccess::ValidatorSimple::VERSION = '0.104'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 7 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | with qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | Syccess::Validator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | requires qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | validator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 31 | ▶ | sub validate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: called CC=11 SCAR=30.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 31 | my ( $self, %params ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 31 | my $name = $self->syccess_field->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 31 | ▶ | return if !exists($params{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not exists $params{$name} and $self->missing_ok
MC/DC50%1/2
not exists $params{$name} and $self->missing_ok
not exists $params{$name}
$self->missing_ok
Truth table66%2/3
not(A) and B
A= not exists $params{$name}B= $self->missing_ok
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | && $self->missing_ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | return if exists($params{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 28 | ▶ | && !defined($params{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
exists $params{$name} and not defined $params{$name} and $self->undef_ok
exists $params{$name} and not defined $params{$name}
MC/DC0%0/3
exists $params{$name} and not defined $params{$name} and $self->undef_ok
exists $params{$name}
not defined $params{$name}
$self->undef_ok
Truth table25%1/4
A and not(B) and C
A= exists $params{$name}B= not defined $params{$name}C= $self->undef_ok
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | && $self->undef_ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | return if exists($params{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | && defined($params{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 28 | ▶ | && $params{$name} eq '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
exists $params{$name} and defined $params{$name} and $params{$name} eq "" and $self->empty_ok
exists $params{$name} and defined $params{$name} and $params{$name} eq ""
exists $params{$name} and defined $params{$name}
MC/DC0%0/4
exists $params{$name} and defined $params{$name} and $params{$name} eq "" and $self->empty_ok
exists $params{$name}
defined $params{$name}
$params{$name} eq ""
$self->empty_ok
Truth table20%1/5
A and B and C and D
A= exists $params{$name}B= defined $params{$name}C= $params{$name} eq ""D= $self->empty_ok
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | && $self->empty_ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | return exists($params{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 28 | ▶ | ? $self->validator($params{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | : $self->validator(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 3 | ▶ | sub missing_ok { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
missing_ok: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub undef_ok { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
undef_ok: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub empty_ok { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
empty_ok: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||