blib/lib/Badger/Data/Facet/Text.pm untested

filter: Statementstmt 0.0% 0 / 6 Branchbran n/a Conditioncond 0.0% 0 / 8 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 17 CC 1 SCAR 6.9
CC
1
Cov
0%
validate
2.0
BEGIN
2.0
CRAP 2.0
1 package Badger::Data::Facet::Text;
2  
3 use Badger::Class
4 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 };
15  
16  
17 sub validate {
18 my ($self, $value, $type) = @_;
19  
20 return textlike $$value
21 || $self->invalid_msg( not_text => $type || 'Text', ref $value || $value );
22 }
23  
24  
25 1;
26  
27 __END__