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   18603 use warnings;
  1         2  
  1         22  
4 1     1   4 use strict;
  1         1  
  1         18  
5 1     1   409 use Moo;
  1         11695  
  1         4  
6 1     1   1512 use namespace::clean;
  1         8748  
  1         5  
7              
8             our $VERSION = '0.05';
9              
10             extends 'MooX::Value';
11              
12             sub _why_invalid
13             {
14 16     16   11 my ($self, $value) = @_;
15 16 100       34 return (__PACKAGE__ . ': No identifier supplied', '', undef) unless defined $value;
16 15 100       31 return (__PACKAGE__ . ': Empty identifier supplied', '', undef) unless length $value;
17 14 100       40 return (__PACKAGE__ . ': Invalid initial character', '', undef) unless $value =~ m/\A[a-zA-Z_]/;
18 12 100       43 return (__PACKAGE__ . ': Invalid character in identifier', '', undef)
19             unless $value =~ m/\A[a-zA-Z_][a-zA-Z0-9_]*\z/;
20 11         15 return;
21             }
22              
23             1;
24             __END__