| 1 | package FormValidator::Nested::Validator::String; | ||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 8 | ▶ | use List::MoreUtils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 57 | ▶ | sub max_length { | ||||||||||||||||||||||||||
|
Subroutine
max_length: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | 57 | my ( $value, $options, $req ) = @_; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 57 | ▶ | if ( length $value > $options->{max} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 13 | 2 | return 0; | |||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | 55 | return 1; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 3 | ▶ | sub length { | ||||||||||||||||||||||||||
|
Subroutine
length: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 3 | my ( $value, $options, $req ) = @_; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 3 | ▶ | if ( length $value != $options->{'length'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | 2 | return 0; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | 1 | return 1; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 4 | ▶ | sub between_length { | ||||||||||||||||||||||||||
|
Subroutine
between_length: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 4 | my ( $value, $options, $req ) = @_; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 4 | my $length = CORE::length $value; | |||||||||||||||||||||||||||
| 31 | 4 | ▶ | if ( $length < $options->{'min'} || $length > $options->{'max'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$length < $options->{"min"} or $length > $options->{"max"}
MC/DC100%2/2
$length < $options->{"min"} or $length > $options->{"max"}
$length < $options->{"min"}
$length > $options->{"max"}
Truth table100%3/3
A or B
A= $length < $options->{"min"}B= $length > $options->{"max"}
| |||||||||||||||||||||||||||||
| 32 | 2 | return 0; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | 2 | return 1; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 6 | ▶ | sub alpha_num { | ||||||||||||||||||||||||||
|
Subroutine
alpha_num: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 38 | 6 | my ( $value, $options, $req ) = @_; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 6 | ▶ | if ( $value =~ /[^0-9a-zA-Z]/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 3 | return 0; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | 3 | return 1; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 5 | ▶ | sub ascii { | ||||||||||||||||||||||||||
|
Subroutine
ascii: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 5 | my ( $value, $options, $req ) = @_; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 5 | ▶ | if ( $value =~ /\P{ASCII}/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 2 | return 0; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | 3 | return 1; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 3 | ▶ | sub in { | ||||||||||||||||||||||||||
|
Subroutine
in: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | 3 | my ( $value, $options, $req ) = @_; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 3 | ▶ | if ( List::MoreUtils::none { $value eq $_ } @{$options->{list}} ) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 1 | return 0; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | 2 | return 1; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 4 | ▶ | sub no_break { | ||||||||||||||||||||||||||
|
Subroutine
no_break: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 65 | 4 | my ( $value, $options, $req ) = @_; | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 4 | ▶ | if ( $value =~ /[\x{0a}\x{0d}]/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | 3 | return 0; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | 1 | return 1; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 8 | 1; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||