Object/People.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 96.6% 29 / 30 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Object/Series.pm ↑ Summary Object/Kramerius.pm »
1 package MARC::Convert::Wikidata::Object::People;
2  
3 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 19 ▶use MARC::Convert::Wikidata::Object::Utils qw(check_date check_date_order);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 19 ▶use Mo qw(build is);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 19 our $VERSION = 0.01;
10  
11 19 has date_of_birth => (
12 is => 'ro',
13 );
14  
15 19 has date_of_death => (
16 is => 'ro',
17 );
18  
19 19 has name => (
20 is => 'ro',
21 );
22  
23 19 has nkcr_aut => (
24 is => 'ro',
25 );
26  
27 19 has surname => (
28 is => 'ro',
29 );
30  
31 sub BUILD {
32 28 ▶ my $self = shift;
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
33  
34 28 check_date($self, 'date_of_birth');
35 27 check_date($self, 'date_of_death');
36  
37 27 check_date_order($self, 'date_of_birth', 'date_of_death');
38  
39 26 return;
40 }
41  
42 19 1;
43  
44 __END__
45  
46 =pod
47  
48 =encoding utf8
49  
50 =head1 NAME
51  
52 MARC::Convert::Wikidata::Object::People - Bibliographic Wikidata object for people defined by MARC record.
53  
54 =head1 SYNOPSIS
55  
56 use MARC::Convert::Wikidata::Object::People;
57  
58 my $obj = MARC::Convert::Wikidata::Object::People->new(%params);
59 my $date_of_birth = $obj->date_of_birth;
60 my $date_of_death = $obj->date_of_death;
61 my $name = $obj->name;
62 my $nkcr_aut = $obj->nkcr_aut;
63 my $surname = $obj->surname;
64  
65 =head1 METHODS
66  
67 =head2 C<new>
68  
69 my $obj = MARC::Convert::Wikidata::Object::People->new(%params);
70  
71 Constructor.
72  
73 Returns instance of object.
74  
75 =over 8
76  
77 =item * C<date_of_birth>
78  
79 Date of birth of people.
80  
81 Parameter is string with date. See L<MARC::Convert::Wikidata::Object::Utils/check_date> for more information.
82  
83 Default value is undef.
84  
85 =item * C<date_of_death>
86  
87 Date of death of people.
88  
89 Parameter is string with date. See L<MARC::Convert::Wikidata::Object::Utils/check_date> for more information.
90  
91 Default value is undef.
92  
93 =item * C<name>
94  
95 Given name of people.
96  
97 Default value is undef.
98  
99 =item * C<nkcr_aut>
100  
101 ID in National library of the Czech Republic authority database.
102  
103 Default value is undef.
104  
105 =item * C<surname>
106  
107 Surname of people.
108  
109 Default value is undef.
110  
111 =back
112  
113 =head2 C<date_of_birth>
114  
115 my $date_of_birth = $obj->date_of_birth;
116  
117 Get date of birth.
118  
119 Returns string.
120  
121 =head2 C<date_of_death>
122  
123 my $date_of_death = $obj->date_of_death;
124  
125 Get date of death.
126  
127 Returns string.
128  
129 =head2 C<name>
130  
131 my $name = $obj->name;
132  
133 Get given name.
134  
135 Returns string.
136  
137 =head2 C<nkcr_aut>
138  
139 my $nkcr_aut = $obj->nkcr_aut;
140  
141 Get ID from National Library of the Czech Republic authority database.
142  
143 Returns string.
144  
145 =head2 C<surname>
146  
147 my $surname = $obj->surname;
148  
149 Get surname.
150  
151 Returns string.
152  
153 =head1 ERRORS
154  
155 new():
156 From MARC::Convert::Wikidata::Object::Utils::check_date():
157 Parameter 'date_of_birth' for date is in bad format.
158 Parameter 'date_of_birth' has year greater than actual year.
159 Parameter 'date_of_death' for date is in bad format.
160 Parameter 'date_of_death' has year greater than actual year.
161 From MARC::Convert::Wikidata::Object::Utils::check_date_order():
162 Parameter 'date_of_birth' has date greater or same as parameter 'date_of_death' date.
163  
164 =head1 EXAMPLE1
165  
166 =for comment filename=create_and_dump_people.pl
167  
168 use strict;
169 use warnings;
170  
171 use Data::Printer;
172 use MARC::Convert::Wikidata::Object::People;
173 use Unicode::UTF8 qw(decode_utf8);
174
175 my $obj = MARC::Convert::Wikidata::Object::People->new(
176 'date_of_birth' => '1952-12-08',
177 'name' => decode_utf8('Jiří'),
178 'nkcr_aut' => 'jn20000401266',
179 'surname' => 'Jurok',
180 );
181
182 p $obj;
183  
184 # Output:
185 # MARC::Convert::Wikidata::Object::People {
186 # Parents Mo::Object
187 # public methods (7) : BUILD, can (UNIVERSAL), DOES (UNIVERSAL), err (Error::Pure), check_date (MARC::Convert::Wikidata::Object::Utils), isa (UNIVERSAL), VERSION (UNIVERSAL)
188 # private methods (1) : __ANON__ (Mo::build)
189 # internals: {
190 # date_of_birth "1952-12-08",
191 # name "Jiří",
192 # nkcr_aut "jn20000401266",
193 # surname "Jurok"
194 # }
195 # }
196  
197 =head1 DEPENDENCIES
198  
199 L<MARC::Convert::Wikidata::Object::Utils>,
200 L<Mo>.
201  
202 =head1 SEE ALSO
203  
204 =over
205  
206 =item L<MARC::Convert::Wikidata>
207  
208 Conversion class between MARC record and Wikidata object.
209  
210 =back
211  
212 =head1 REPOSITORY
213  
214 L<https://github.com/michal-josef-spacek/MARC-Convert-Wikidata-Object>
215  
216 =head1 AUTHOR
217  
218 Michal Josef Špaček L<mailto:skim@cpan.org>
219  
220 L<http://skim.cz>
221  
222 =head1 LICENSE AND COPYRIGHT
223  
224 © Michal Josef Špaček 2021-2023
225  
226 BSD 2-Clause License
227  
228 =head1 VERSION
229  
230 0.01
231  
232 =cut
« Object/Series.pm ↑ Summary Object/Kramerius.pm »