File Coverage

blib/lib/Value/Object/Identifier.pm
Criterion Covered Total %
statement 15 15 100.0
branch 8 8 100.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 27 27 100.0


line stmt bran cond sub pod time code
1             package Value::Object::Identifier;
2              
3 1     1   24894 use warnings;
  1         3  
  1         42  
4 1     1   5 use strict;
  1         1  
  1         36  
5              
6             our $VERSION = '0.14';
7              
8 1     1   680 use parent 'Value::Object';
  1         299  
  1         5  
9              
10             sub _why_invalid
11             {
12 16     16   26 my ($self, $value) = @_;
13 16 100       38 return (ref($self) . ': No identifier supplied', '', undef) unless defined $value;
14 15 100       35 return (ref($self) . ': Empty identifier supplied', '', undef) unless length $value;
15 14 100       50 return (ref($self) . ': Invalid initial character', '', undef) unless $value =~ m/\A[a-zA-Z_]/;
16 12 100       48 return (ref($self) . ': Invalid character in identifier', '', undef)
17             unless $value =~ m/\A[a-zA-Z_][a-zA-Z0-9_]*\z/;
18 11         27 return;
19             }
20              
21             1;
22             __END__