line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Badger::Data::Facet::Text; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use Badger::Class |
4
|
2
|
|
|
|
|
21
|
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
|
|
13
|
}; |
|
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__ |