File Coverage

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 2     2   25708 use warnings;
  2         3  
  2         56  
4 2     2   9 use strict;
  2         4  
  2         77  
5              
6             our $VERSION = '0.15';
7              
8 2     2   679 use parent 'Value::Object';
  2         314  
  2         10  
9              
10             sub _why_invalid
11             {
12 16     16   25 my ($self, $value) = @_;
13 16 100       43 return (ref($self) . ': No identifier supplied', '', undef) unless defined $value;
14 15 100       30 return (ref($self) . ': Empty identifier supplied', '', undef) unless length $value;
15 14 100       51 return (ref($self) . ': Invalid initial character', '', undef) unless $value =~ m/\A[a-zA-Z_]/;
16 12 100       44 return (ref($self) . ': Invalid character in identifier', '', undef)
17             unless $value =~ m/\A[a-zA-Z_][a-zA-Z0-9_]*\z/;
18 11         28 return;
19             }
20              
21             1;
22             __END__