File Coverage

blib/lib/Input/Validator/Constraint/Subset.pm
Criterion Covered Total %
statement 16 16 100.0
branch 4 4 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 25 25 100.0


line stmt bran cond sub pod time code
1             package Input::Validator::Constraint::Subset;
2              
3 1     1   20484 use strict;
  1         2  
  1         30  
4 1     1   4 use warnings;
  1         2  
  1         25  
5              
6 1     1   5 use base 'Input::Validator::Constraint';
  1         1  
  1         464  
7              
8             sub is_valid {
9 8     8 1 761 my ($self, $values) = @_;
10              
11 8 100       41 $values = [$values] unless ref $values eq 'ARRAY';
12              
13 8         15 foreach my $value (@$values) {
14 12 100       20 return 0 unless grep { $value eq $_ } @{$self->args};
  36         126  
  12         48  
15             }
16              
17 5         30 return 1;
18             }
19              
20             1;
21             __END__