| 1 | package Badger::Data::Facet::Text; | |||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | use Badger::Class | |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | 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 | ▶ | }; | |||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | sub validate { | |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | my ($self, $value, $type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: called CC=4 SCAR=22.5
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | return textlike $$value | |||||||||||||||||||||||||||||||||||||||||||||
|
Condition12%1/8
&textlike($$value) || $self->invalid_msg('not_text', $type || 'Text', ref $value || $value)
$type || 'Text'
ref $value || $value
MC/DC0%0/2
&textlike($$value) || $self->invalid_msg('not_text', $type || 'Text', ref $value || $value)
&textlike($$value)
$self->invalid_msg('not_text', $type || 'Text', ref $value || $value)
MC/DC0%0/1
$type || 'Text'
$type
MC/DC0%0/2
ref $value || $value
ref $value
$value
Truth table33%1/3
A || B
A= &textlike($$value)B= $self->invalid_msg('not_text', $type || 'Text', ref $value || $value)
Truth table0%0/2
A
A= $type
Truth table0%0/3
A || B
A= ref $valueB= $value
| ||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | || $self->invalid_msg( not_text => $type || 'Text', ref $value || $value ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | __END__ | |||||||||||||||||||||||||||||||||||||||||||||||