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   23407 use warnings;
  18         50  
  18         417  
4 18     18   85  
  18         31  
  18         343  
5             use Moo::Role;
6 18     18   83 use Types::Standard qw(ConsumerOf);
  18         34  
  18         93  
7 18     18   7495 use namespace::clean;
  18         146369  
  18         279  
8 18     18   12469  
  18         36  
  18         117  
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 3724  
21             my ($self, $field, $input) = @_;
22              
23             if (
24 106     106   254 exists $input->{$field}
25             and defined $input->{$field}
26 106 100 66     827 and $input->{$field} ne ''
      100        
27             ) {
28             return 1;
29             }
30              
31 94         346 return 0;
32             }
33              
34 12         43 1;