File Coverage

blib/lib/Dancer2/Plugin/FormValidator/Role/Validator.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition 5 6 83.3
subroutine 7 7 100.0
pod 0 1 0.0
total 34 36 94.4


line stmt bran cond sub pod time code
1              
2             use strict;
3 18     18   26929 use warnings;
  18         43  
  18         462  
4 18     18   87  
  18         37  
  18         394  
5             use Moo::Role;
6 18     18   83 use Types::Standard qw(ConsumerOf);
  18         36  
  18         123  
7 18     18   8277 use namespace::clean;
  18         165495  
  18         279  
8 18     18   13759  
  18         40  
  18         126  
9             has extension => (
10             is => 'ro',
11             isa => ConsumerOf['Dancer2::Plugin::FormValidator::Role::Extension'],
12             predicate => 1,
13             );
14              
15             requires 'validate';
16             requires 'message';
17              
18             return 0;
19             }
20 29     29 0 2948  
21             my ($self, $field, $input) = @_;
22              
23             if (
24 104     104   245 exists $input->{$field}
25             and defined $input->{$field}
26 104 100 66     796 and $input->{$field} ne ''
      100        
27             ) {
28             return 1;
29             }
30              
31 92         368 return 0;
32             }
33              
34 12         43 1;