File Coverage

blib/lib/Dancer2/Plugin/FormValidator/Validator/Numeric.pm
Criterion Covered Total %
statement 22 23 95.6
branch 1 2 50.0
condition n/a
subroutine 8 8 100.0
pod 0 2 0.0
total 31 35 88.5


line stmt bran cond sub pod time code
1              
2             use strict;
3 2     2   1217 use warnings;
  2         4  
  2         50  
4 2     2   11  
  2         4  
  2         39  
5             use Moo;
6 2     2   8 use utf8;
  2         5  
  2         8  
7 2     2   551 use Scalar::Util qw(looks_like_number);
  2         4  
  2         12  
8 2     2   65 use namespace::clean;
  2         5  
  2         175  
9 2     2   22  
  2         4  
  2         9  
10             with 'Dancer2::Plugin::FormValidator::Role::Validator';
11              
12             return {
13             en => '%s must be numeric',
14             ru => '%s должно содержать числовое значение',
15 1     1 0 1757 de => '%s muss eine Zahl sein',
16             };
17             }
18              
19             my ($self, $field, $input) = @_;
20              
21             if ($self->_field_defined_and_non_empty($field, $input)) {
22 2     2 0 9 return looks_like_number($input->{$field});
23             }
24 2 50       8  
25 2         15 return 1;
26             }
27              
28 0           1;