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 2     2   23587 use warnings;
  2         4  
  2         53  
4 2     2   9 use strict;
  2         4  
  2         63  
5              
6             our $VERSION = '0.13';
7              
8 2     2   611 use parent 'Value::Object';
  2         261  
  2         10  
9              
10             sub _why_invalid
11             {
12 16     16   20 my ($self, $value) = @_;
13 16 100       38 return (ref($self) . ': No identifier supplied', '', undef) unless defined $value;
14 15 100       32 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       42 return (ref($self) . ': Invalid character in identifier', '', undef)
17             unless $value =~ m/\A[a-zA-Z_][a-zA-Z0-9_]*\z/;
18 11         23 return;
19             }
20              
21             1;
22             __END__