File Coverage

blib/lib/MooX/Value/Identifier.pm
Criterion Covered Total %
statement 18 18 100.0
branch 8 8 100.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 31 31 100.0


line stmt bran cond sub pod time code
1             package MooX::Value::Identifier;
2              
3 1     1   18542 use warnings;
  1         1  
  1         27  
4 1     1   4 use strict;
  1         1  
  1         21  
5 1     1   480 use Moo;
  1         12952  
  1         9  
6 1     1   1988 use namespace::clean;
  1         9784  
  1         5  
7              
8             our $VERSION = '0.03';
9              
10             extends 'MooX::Value';
11              
12             sub _why_invalid
13             {
14 16     16   17 my ($self, $value) = @_;
15 16 100       37 return (__PACKAGE__ . ': No identifier supplied', '', undef) unless defined $value;
16 15 100       28 return (__PACKAGE__ . ': Empty identifier supplied', '', undef) unless length $value;
17 14 100       39 return (__PACKAGE__ . ': Invalid initial character', '', undef) unless $value =~ m/\A[a-zA-Z_]/;
18 12 100       40 return (__PACKAGE__ . ': Invalid character in identifier', '', undef)
19             unless $value =~ m/\A[a-zA-Z_][a-zA-Z0-9_]*\z/;
20 11         20 return;
21             }
22              
23             1;
24             __END__