blib/lib/Data/Person.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 package Data::Person;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶use Mo qw(build default is);
Subroutine BEGIN: called CC=1 SCAR=2.6
7 use Mo::utils 0.21 qw(check_length check_strings);
8 use Mo::utils::Array qw(check_array_object);
9 use Mo::utils::Number qw(check_positive_natural);
10 use Mo::utils::Email qw(check_email);
11 use Readonly;
12  
13 Readonly::Array our @SEX => qw(female male unknown);
14  
15 our $VERSION = 0.06;
16  
17 has email => (
18 is => 'ro',
19 );
20  
21 has external_ids => (
22 default => [],
23 is => 'ro',
24 );
25  
26 has id => (
27 is => 'ro',
28 );
29  
30 has name => (
31 is => 'ro',
32 );
33  
34 has sex => (
35 is => 'ro',
36 );
37  
38 sub BUILD {
39 my $self = shift;
40  
41 # Check email.
42 check_email($self, 'email');
43  
44 # Check external_ids.
45 check_array_object($self, 'external_ids', 'Data::ExternalId');
46  
47 # Check id.
48 check_positive_natural($self, 'id');
49  
50 # Check name.
51 check_length($self, 'name', 255);
52  
53 # Check sex.
54 check_strings($self, 'sex', \@SEX);
55  
56 return;
57 }
58  
59 1;
60  
61 __END__
↑ Summary