File Coverage

lib/Badger/Data/Facet/Text/MaxLength.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::MaxLength;
2              
3             use Badger::Data::Facet::Class
4 2         20 version => 0.01,
5             type => 'text',
6 2     2   14 args => 'max_length';
  2         4  
7              
8              
9             sub validate {
10 5     5 1 11 my ($self, $text, $type) = @_;
11              
12             return length($$text) <= $self->{ max_length }
13             || $self->invalid_msg(
14             too_long => $type || 'Text',
15 5   66     36 $self->{ max_length }, length($$text)
16             );
17             }
18              
19             1;
20              
21             __END__