| lib/Badger/Data/Facet/Text/Length.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % | 
| statement | 5 | 5 | 100.0 | 
| branch | n/a | ||
| condition | 2 | 3 | 66.6 | 
| subroutine | 2 | 2 | 100.0 | 
| pod | 1 | 1 | 100.0 | 
| total | 10 | 11 | 90.9 | 
| line | stmt | bran | cond | sub | pod | time | code | 
|---|---|---|---|---|---|---|---|
| 1 | package Badger::Data::Facet::Text::Length; | ||||||
| 2 | |||||||
| 3 | use Badger::Data::Facet::Class | ||||||
| 4 | 1 | 6 | version => 0.01, | ||||
| 5 | type => 'text', | ||||||
| 6 | 1 | 1 | 313 | args => 'length'; | |||
| 1 | 2 | ||||||
| 7 | |||||||
| 8 | |||||||
| 9 | sub validate { | ||||||
| 10 | 2 | 2 | 1 | 3 | my ($self, $text, $type) = @_; | ||
| 11 | |||||||
| 12 | return CORE::length($$text) == $self->{ length } | ||||||
| 13 | || $self->invalid_msg( | ||||||
| 14 | wrong_length => $type || 'Text', | ||||||
| 15 | 2 | 66 | 13 | $self->{ length }, CORE::length($$text) | |||
| 16 | ); | ||||||
| 17 | } | ||||||
| 18 | |||||||
| 19 | 1; | ||||||
| 20 | |||||||
| 21 | __END__ |