lib/Badger/Data/Facet/Text.pm

filter: Statementstmt 100% 6 / 6 Branchbran n/a Conditioncond 12.5% 1 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 45.4% 10 / 22 CC 4 SCAR 20.5
CC
4
Cov
50%
validate
9.5
BEGIN
1.0
CRAP 7.8
« lib/Badger/Filesystem/Visitor.pm ↑ Summary lib/Badger/Modules.pm »
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)
l!l
100
$type || 'Text'
l!l
00
ref $value || $value
l!l&&r!l&&!r
000
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)
ABresult
1X1
011
000
Truth table0%0/2
A
A= $type
Aresult
11
00
Truth table0%0/3
A || B
A= ref $valueB= $value
ABresult
1X1
011
000
21 || $self->invalid_msg( not_text => $type || 'Text', ref $value || $value );
22 }
23  
24  
25 2 1;
26  
27 __END__
« lib/Badger/Filesystem/Visitor.pm ↑ Summary lib/Badger/Modules.pm »