File Coverage

lib/Badger/Data/Facet/Number.pm
Criterion Covered Total %
statement 5 5 100.0
branch n/a
condition 2 2 100.0
subroutine 2 2 100.0
pod 1 1 100.0
total 10 10 100.0


line stmt bran cond sub pod time code
1             package Badger::Data::Facet::Number;
2              
3             use Badger::Class
4 1         12 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   7 };
  1         2  
12              
13              
14             sub validate {
15 2     2 1 4 my ($self, $value, $type) = @_;
16              
17 2   100     18 return numlike $$value
18             || $self->invalid_msg( not_number => $type || 'Text', $$value );
19             }
20              
21              
22             1;
23              
24             __END__