lib/Badger/Data/Facet/Text/MinLength.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 5 | 5 | 100.0 |
branch | n/a | ||
condition | 2 | 3 | 66.6 |
subroutine | 2 | 2 | 100.0 |
pod | 1 | 1 | 100.0 |
total | 10 | 11 | 90.9 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Badger::Data::Facet::Text::MinLength; | ||||||
2 | |||||||
3 | use Badger::Data::Facet::Class | ||||||
4 | 2 | 18 | version => 0.01, | ||||
5 | type => 'text', | ||||||
6 | 2 | 2 | 358 | args => 'min_length'; | |||
2 | 11 | ||||||
7 | |||||||
8 | |||||||
9 | sub validate { | ||||||
10 | 6 | 6 | 1 | 13 | my ($self, $text, $type) = @_; | ||
11 | |||||||
12 | return length($$text) >= $self->{ min_length } | ||||||
13 | || $self->invalid_msg( | ||||||
14 | 6 | 66 | 40 | too_short => $type || 'Text', $self->{ min_length }, length($$text) | |||
15 | ); | ||||||
16 | } | ||||||
17 | |||||||
18 | 1; | ||||||
19 | |||||||
20 | __END__ |