File Coverage

lib/Badger/Data/Facet/Text.pm
Criterion Covered Total %
statement 5 5 100.0
branch n/a
condition 1 3 33.3
subroutine 2 2 100.0
pod 1 1 100.0
total 9 11 81.8


line stmt bran cond sub pod time code
1             package Badger::Data::Facet::Text;
2              
3             use Badger::Class
4 2         23 version => 0.01,
5             base => 'Badger::Data::Facet',
6             utils => 'textlike',
7             messages => {
8             not_text => '%s is not text (got %s)',
9             wrong_length => '%s should be %d characters long (got %d)',
10             too_short => '%s should be at least %d characters long (got %d)',
11             too_long => '%s should be at most %d characters long (got %d)',
12             pattern => '%s does not match pattern: %s',
13             whitespace => 'Invalid whitespace option: %s (expected one of: %s)',
14 2     2   12 };
  2         4  
15              
16              
17             sub validate {
18 1     1 1 2 my ($self, $value, $type) = @_;
19              
20 1   33     3 return textlike $$value
21             || $self->invalid_msg( not_text => $type || 'Text', ref $value || $value );
22             }
23              
24              
25             1;
26              
27             __END__