blib/lib/Input/Validator/Constraint/Regexp.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 12 | 12 | 100.0 |
branch | 2 | 2 | 100.0 |
condition | n/a | ||
subroutine | 4 | 4 | 100.0 |
pod | 1 | 1 | 100.0 |
total | 19 | 19 | 100.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Input::Validator::Constraint::Regexp; | ||||||
2 | |||||||
3 | 6 | 6 | 30083 | use strict; | |||
6 | 14 | ||||||
6 | 232 | ||||||
4 | 6 | 6 | 34 | use warnings; | |||
6 | 11 | ||||||
6 | 217 | ||||||
5 | |||||||
6 | 6 | 6 | 26 | use base 'Input::Validator::Constraint'; | |||
6 | 114 | ||||||
6 | 3035 | ||||||
7 | |||||||
8 | sub is_valid { | ||||||
9 | 35 | 35 | 1 | 724 | my ($self, $value) = @_; | ||
10 | |||||||
11 | 35 | 119 | my $re = $self->args; | ||||
12 | |||||||
13 | 35 | 100 | 253 | return $value =~ m/$re/ ? 1 : 0; | |||
14 | } | ||||||
15 | |||||||
16 | 1; | ||||||
17 | __END__ |