line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Badger::Data::Facet::Number; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use Badger::Class |
4
|
1
|
|
|
|
|
10
|
version => 0.01, |
5
|
|
|
|
|
|
|
base => 'Badger::Data::Facet', |
6
|
|
|
|
|
|
|
utils => 'numlike', |
7
|
|
|
|
|
|
|
messages => { |
8
|
|
|
|
|
|
|
not_number => '%s is not a number (got %s)', |
9
|
|
|
|
|
|
|
too_small => '%s should be no less than %d (got %d)', |
10
|
|
|
|
|
|
|
too_large => '%s should be no more than %d (got %d)', |
11
|
1
|
|
|
1
|
|
6
|
}; |
|
1
|
|
|
|
|
1
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub validate { |
15
|
2
|
|
|
2
|
1
|
3
|
my ($self, $value, $type) = @_; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
100
|
|
|
13
|
return numlike $$value |
18
|
|
|
|
|
|
|
|| $self->invalid_msg( not_number => $type || 'Text', $$value ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
__END__ |