lib/Badger/Data/Facet/List/Size.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 5 | 5 | 100.0 |
branch | 2 | 2 | 100.0 |
condition | 1 | 2 | 50.0 |
subroutine | 2 | 2 | 100.0 |
pod | 1 | 1 | 100.0 |
total | 11 | 12 | 91.6 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Badger::Data::Facet::List::Size; | ||||||
2 | |||||||
3 | use Badger::Data::Facet::Class | ||||||
4 | 1 | 8 | version => 0.01, | ||||
5 | type => 'list', | ||||||
6 | 1 | 1 | 367 | args => 'size'; | |||
1 | 3 | ||||||
7 | |||||||
8 | |||||||
9 | sub validate { | ||||||
10 | 2 | 2 | 1 | 5 | my ($self, $value, $type) = @_; | ||
11 | |||||||
12 | return scalar(@$value) == $self->{ size } | ||||||
13 | ? $value | ||||||
14 | : $self->invalid_msg( | ||||||
15 | 2 | 100 | 50 | 15 | wrong_size => $type || 'List', $self->{ size }, scalar(@$value) | ||
16 | ); | ||||||
17 | } | ||||||
18 | |||||||
19 | 1; | ||||||
20 | |||||||
21 | __END__ |