Object/People.pm

filter: Statementstmt 100% 40 / 40 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 50.0% 1 / 2 totaltotal 98.1% 52 / 53 CC 3 SCAR 5.1
CC
3
Cov
100%
full_name
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« Object/PublicationDate.pm ↑ Summary Object/ExternalId.pm »
1 package MARC::Convert::Wikidata::Object::People;
2  
3 23 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 23 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 23 ▶use Mo qw(build default is);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 23 ▶use Mo::utils::Array qw(check_array_object);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 23 ▶use Mo::utils::Date 0.04 qw(check_date check_date_order);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 23 our $VERSION = 0.16;
11  
12 23 has date_of_birth => (
13 is => 'ro',
14 );
15  
16 23 has date_of_death => (
17 is => 'ro',
18 );
19  
20 23 has external_ids => (
21 default => [],
22 is => 'ro',
23 );
24  
25 23 has name => (
26 is => 'ro',
27 );
28  
29 23 has surname => (
30 is => 'ro',
31 );
32  
33 23 has work_period_start => (
34 is => 'ro',
35 );
36  
37 23 has work_period_end => (
38 is => 'ro',
39 );
40  
41 4 ▶sub full_name {
Subroutine full_name: called CC=3 SCAR=11.0
Pod documented
42 4 my $self = shift;
43  
44 4 my $full_name = $self->name;
45 4 ▶ if (defined $self->surname) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->surname) 2 2 4
46 2 ▶ if ($full_name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($full_name) 1 1 2
47 1 $full_name .= ' ';
48 }
49 2 $full_name .= $self->surname;
50 }
51  
52 4 return $full_name;
53 }
54  
55 39 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
56 39 my $self = shift;
57  
58 # Check 'date_of_birth'.
59 39 check_date($self, 'date_of_birth');
60  
61 # Check 'date_of_death'.
62 38 check_date($self, 'date_of_death');
63  
64 # Check date order.
65 38 check_date_order($self, 'date_of_birth', 'date_of_death');
66  
67 # Check 'external_ids'.
68 37 check_array_object($self, 'external_ids', 'MARC::Convert::Wikidata::Object::ExternalId');
69  
70 # Check 'work_period_start'.
71 37 check_date($self, 'work_period_start');
72  
73 # Check 'work_period_end'.
74 36 check_date($self, 'work_period_end');
75  
76 # Check date workd date order.
77 35 check_date_order($self, 'work_period_start', 'work_period_end');
78  
79 34 return;
80 }
81  
82 23 1;
83  
84 __END__
« Object/PublicationDate.pm ↑ Summary Object/ExternalId.pm »