File Coverage

blib/lib/Data/MARC/Field008/ContinuingResource.pm
Criterion Covered Total %
statement 50 51 98.0
branch 4 6 66.6
condition n/a
subroutine 8 8 100.0
pod 0 1 0.0
total 62 66 93.9


line stmt bran cond sub pod time code
1             package Data::MARC::Field008::ContinuingResource;
2              
3 14     14   209290 use strict;
  14         33  
  14         726  
4 14     14   77 use warnings;
  14         29  
  14         1303  
5              
6 14         506 use Data::MARC::Field008::Utils qw(check_conference_publication
7             check_continuing_resource_entry_convention
8             check_continuing_resource_form_of_original_item
9             check_continuing_resource_frequency
10             check_continuing_resource_nature_of_content
11             check_continuing_resource_nature_of_entire_work
12             check_continuing_resource_original_alphabet_or_script
13             check_continuing_resource_regularity
14             check_continuing_resource_type
15 14     14   10617 check_government_publication check_item_form);
  14         114  
16 14     14   5572 use Error::Pure qw(err);
  14         58  
  14         1014  
17 14     14   112 use Error::Pure::Utils qw(clean err_get);
  14         48  
  14         464  
18 14     14   8935 use Mo qw(build is);
  14         9570  
  14         80  
19 14     14   32269 use Mo::utils 0.22 qw(check_length_fix check_required);
  14         44033  
  14         416  
20              
21             our $STRICT = 1;
22              
23             our $VERSION = 0.04;
24              
25             has conference_publication => (
26             is => 'ro',
27             );
28              
29             has entry_convention => (
30             is => 'ro',
31             );
32              
33             has form_of_item => (
34             is => 'ro',
35             );
36              
37             has form_of_original_item => (
38             is => 'ro',
39             );
40              
41             has frequency => (
42             is => 'ro',
43             );
44              
45             has government_publication => (
46             is => 'ro',
47             );
48              
49             has nature_of_content => (
50             is => 'ro',
51             );
52              
53             has nature_of_entire_work => (
54             is => 'ro',
55             );
56              
57             has original_alphabet_or_script_of_title => (
58             is => 'ro',
59             );
60              
61             has raw => (
62             is => 'ro',
63             );
64              
65             has regularity => (
66             is => 'ro',
67             );
68              
69             has type_of_continuing_resource => (
70             is => 'ro',
71             );
72              
73             sub BUILD {
74 14     14 0 4359600 my $self = shift;
75              
76             # Check 'raw'.
77 14         121 check_length_fix($self, 'raw', 17);
78              
79             # Check 'conference_publication'.
80 14         289 eval { check_conference_publication($self, 'conference_publication'); };
  14         123  
81              
82             # Check 'entry_convention'.
83 14         2167 eval {check_continuing_resource_entry_convention($self, 'entry_convention'); };
  14         54  
84              
85             # Check 'form_of_item'.
86 14         892 eval { check_item_form($self, 'form_of_item'); };
  14         64  
87              
88             # Check 'form_of_original_item'.
89 14         856 eval { check_continuing_resource_form_of_original_item($self, 'form_of_original_item'); };
  14         59  
90              
91             # Check 'frequency'.
92 14         847 eval { check_continuing_resource_frequency($self, 'frequency'); };
  14         56  
93              
94             # Check 'government_publication'.
95 14         1229 eval { check_government_publication($self, 'government_publication'); };
  14         84  
96              
97             # Check 'nature_of_content'.
98 14         837 eval { check_continuing_resource_nature_of_content($self, 'nature_of_content'); };
  14         54  
99              
100             # Check 'nature_of_entire_work'.
101 14         856 eval { check_continuing_resource_nature_of_entire_work($self, 'nature_of_entire_work'); };
  14         57  
102              
103             # Check 'original_alphabet_or_script_of_title'.
104 14         881 eval { check_continuing_resource_original_alphabet_or_script($self, 'original_alphabet_or_script_of_title'); };
  14         110  
105              
106             # Check 'regularity'.
107 14         861 eval { check_continuing_resource_regularity($self, 'regularity'); };
  14         54  
108              
109             # Check 'type_of_continuing_resource'.
110 14         1076 eval { check_continuing_resource_type($self, 'type_of_continuing_resource'); };
  14         190  
111              
112 14 50       930 if ($STRICT) {
113 14         78 my @errors = err_get();
114 14 100       167 if (@errors) {
115 1 50       5 err "Couldn't create data object of continuing resource.",
116             defined $self->raw ? ('Raw string', $self->raw) : (),
117             ;
118             }
119             } else {
120 0         0 clean();
121             }
122              
123 13         65 return;
124             }
125              
126             1;
127              
128             __END__
129              
130             =pod
131              
132             =encoding utf8
133              
134             =head1 NAME
135              
136             Data::MARC::Field008::ContinuingResource - Data object for MARC field 008 continuing resource material.
137              
138             =head1 SYNOPSIS
139              
140             use Data::MARC::Field008::ContinuingResource;
141              
142             my $obj = Data::MARC::Field008::ContinuingResource->new(%params);
143             my $conference_publication = $obj->conference_publication;
144             my $entry_convention = $obj->entry_convention;
145             my $form_of_item = $obj->form_of_item;
146             my $form_of_original_item = $obj->form_of_original_item;
147             my $frequency = $obj->frequency;
148             my $government_publication = $obj->government_publication;
149             my $nature_of_content = $obj->nature_of_content;
150             my $nature_of_entire_work = $obj->nature_of_entire_work;
151             my $original_alphabet_or_script_of_title = $obj->original_alphabet_or_script_of_title;
152             my $raw = $obj->raw;
153             my $regularity = $obj->regularity;
154             my $type_of_continuing_resource = $obj->type_of_continuing_resource;
155              
156             =head1 METHODS
157              
158             =head2 C<new>
159              
160             my $obj = Data::MARC::Field008::ContinuingResource->new(%params);
161              
162             Constructor.
163              
164             =over 8
165              
166             =item * C<conference_publication>
167              
168             Conference publication. The length of the item is 1 character.
169             Possible characters are '0', '1' or '|'.
170              
171             It's required.
172              
173             Default value is undef.
174              
175             =item * C<entry_convention>
176              
177             Entry convention. The length of the string is 1 character.
178             Possible characters are '0', '1', '2' or '|'.
179              
180             It's required.
181              
182             Default value is undef.
183              
184             =item * C<form_of_item>
185              
186             Form of item. The length of the item is 1 character.
187             Possible characters are ' ', 'a', 'b', 'c', 'd', 'f', 'o', 'q', 'r', 's' or '|'.
188              
189             It's required.
190              
191             Default value is undef.
192              
193             =item * C<form_of_original_item>
194              
195             Form of original item. The length of the string is 1 character.
196             Possible characters are ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'o', 'q', 's' or '|'.
197              
198             It's required.
199              
200             Default value is undef.
201              
202             =item * C<frequency>
203              
204             Frequency. The length of the string is 1 character.
205             Possible characters are ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
206             'k', 'm', 'q', 's', 't', 'u', 'w', 'z' or '|'.
207              
208             It's required.
209              
210             Default value is undef.
211              
212             =item * C<government_publication>
213              
214             Government publication. The length of the string is 1 character.
215             Possible characters are ' ', 'a', 'c', 'f', 'i', 'l', 'm', 'o', 's', 'u', 'z' or '|'.
216              
217             It's required.
218              
219             Default value is undef.
220              
221             =item * C<nature_of_content>
222              
223             Nature of contents. The length of the string is 3 characters.
224             Possible characters are ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k',
225             'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'z', '5', '6'
226             or '|||'.
227              
228             It's required.
229              
230             Default value is undef.
231              
232             =item * C<nature_of_entire_work>
233              
234             Nature of entire work. The length of the string is 1 character.
235             Possible characters are ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k',
236             'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'z', '5', '6'
237             or '|'.
238              
239             It's required.
240              
241             Default value is undef.
242              
243             =item * C<original_alphabet_or_script_of_title>
244              
245             Original alphabet or script of title. The length of the string is 1 character.
246             Possible characters are ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
247             'k', 'l', 'u', 'z', '|'.
248              
249             It's required.
250              
251             Default value is undef.
252              
253             =item * C<raw>
254              
255             Raw string of material. The length of the string is 17 characters.
256              
257             It's optional.
258              
259             Default value is undef.
260              
261             =item * C<regularity>
262              
263             Regularity. The length of the string is 1 character.
264             Possible characters are 'n', 'r', 'u', 'x' or '|'.
265              
266             It's required.
267              
268             Default value is undef.
269              
270             =item * C<type_of_continuing_resource>
271              
272             Type of continuing resource. The length of the string is 1 character.
273             Possible characters are ' ', 'd', 'g', 'h', 'j', 'l', 'm', 'n', 'p', 'r', 's',
274             't', 'w' or '|'.
275              
276             It's required.
277              
278             Default value is undef.
279              
280             =back
281              
282             Returns instance of object.
283              
284             =head2 C<conference_publication>
285              
286             my $conference_publication = $obj->conference_publication;
287              
288             Get converence publication.
289              
290             Returns string.
291              
292             =head2 C<entry_convention>
293              
294             my $entry_convention = $obj->entry_convention;
295              
296             Get entry convention.
297              
298             Returns string.
299              
300             =head2 C<form_of_item>
301              
302             my $form_of_item = $obj->form_of_item;
303              
304             Get form of item.
305              
306             Returns string.
307              
308             =head2 C<form_of_original_item>
309              
310             my $form_of_original_item = $obj->form_of_original_item;
311              
312             Get form of original item.
313              
314             Returns string.
315              
316             =head2 C<frequency>
317              
318             my $frequency = $obj->frequency;
319              
320             Get frequency.
321              
322             Returns string.
323              
324             =head2 C<government_publication>
325              
326             my $government_publication = $obj->government_publication;
327              
328             Get government publication.
329              
330             Returns string.
331              
332             =head2 C<nature_of_content>
333              
334             my $nature_of_content = $obj->nature_of_content;
335              
336             Get nature of content.
337              
338             Returns string.
339              
340             =head2 C<nature_of_entire_work>
341              
342             my $nature_of_entire_work = $obj->nature_of_entire_work;
343              
344             Get nature of entire work.
345              
346             Returns string.
347              
348             =head2 C<original_alphabet_or_script_of_title>
349              
350             my $original_alphabet_or_script_of_title = $obj->original_alphabet_or_script_of_title;
351              
352             Get original alphabet or script of title.
353              
354             Returns string.
355              
356             =head2 C<raw>
357              
358             my $raw = $obj->form_of_item;
359              
360             Get raw string of the block.
361              
362             Returns string.
363              
364             =head2 C<regularity>
365              
366             my $regularity = $obj->regularity;
367              
368             Get regularity.
369              
370             Returns string.
371              
372             =head2 C<type_of_continuing_resource>
373              
374             my $type_of_continuing_resource = $obj->type_of_continuing_resource;
375              
376             Get type of continuing resource.
377              
378             Returns string.
379              
380             =head1 ERRORS
381              
382             new():
383             Couldn't create data object of continuing resource.
384             Raw string: %s
385             Parameter 'raw' has length different than '17'.
386             Value: %s
387             From Data::MARC::Field008::Utils::check_conference_publication():
388             Parameter 'conference_publication' has bad value.
389             Value: %s
390             Parameter 'conference_publication' is required.
391             Parameter 'conference_publication' length is bad.
392             Length: %s
393             Value: %s
394             Expected length: 1
395             Parameter 'conference_publication' must be a scalar value.
396             Reference: %s
397             From Data::MARC::Field008::Utils::check_continuing_resource_entry_convention():
398             Parameter 'entry_convention' has bad value.
399             Value: %s
400             Parameter 'entry_convention' is required.
401             Parameter 'entry_convention' length is bad.
402             Length: %s
403             Value: %s
404             Expected length: 1
405             Parameter 'entry_convention' must be a scalar value.
406             Reference: %s
407             From Data::MARC::Field008::Utils::check_continuing_resource_form_of_original_item():
408             Parameter 'form_of_original_item' has bad value.
409             Value: %s
410             Parameter 'form_of_original_item' is required.
411             Parameter 'form_of_original_item' length is bad.
412             Length: %s
413             Value: %s
414             Expected length: 1
415             Parameter 'form_of_original_item' must be a scalar value.
416             Reference: %s
417             From Data::MARC::Field008::Utils::check_continuing_resource_frequency():
418             Parameter 'frequency' has bad value.
419             Value: %s
420             Parameter 'frequency' is required.
421             Parameter 'frequency' length is bad.
422             Length: %s
423             Value: %s
424             Expected length: 1
425             Parameter 'frequency' must be a scalar value.
426             Reference: %s
427             From Data::MARC::Field008::Utils::check_continuing_resource_nature_of_content():
428             Parameter 'nature_of_content' has bad value.
429             Value: %s
430             Parameter 'nature_of_content' has value with pipe character.
431             Value: %s
432             Parameter 'nature_of_content' is required.
433             Parameter 'nature_of_content' length is bad.
434             Length: %s
435             Value: %s
436             Expected length: 1
437             Parameter 'nature_of_content' must be a scalar value.
438             Reference: %s
439             From Data::MARC::Field008::Utils::check_continuing_resource_nature_of_entire_work():
440             Parameter 'nature_of_entire_work' has bad value.
441             Value: %s
442             Parameter 'nature_of_entire_work' is required.
443             Parameter 'nature_of_entire_work' length is bad.
444             Length: %s
445             Value: %s
446             Expected length: 1
447             Parameter 'nature_of_entire_work' must be a scalar value.
448             Reference: %s
449             From Data::MARC::Field008::Utils::check_continuing_resource_original_alphabet_or_script():
450             Parameter 'original_alphabet_or_script_of_title' has bad value.
451             Value: %s
452             Parameter 'original_alphabet_or_script_of_title' is required.
453             Parameter 'original_alphabet_or_script_of_title' length is bad.
454             Length: %s
455             Value: %s
456             Expected length: 1
457             Parameter 'original_alphabet_or_script_of_title' must be a scalar value.
458             Reference: %s
459             From Data::MARC::Field008::Utils::check_continuing_resource_regularity():
460             Parameter 'regularity' has bad value.
461             Value: %s
462             Parameter 'regularity' is required.
463             Parameter 'regularity' length is bad.
464             Length: %s
465             Value: %s
466             Expected length: 1
467             Parameter 'regularity' must be a scalar value.
468             Reference: %s
469             From Data::MARC::Field008::Utils::check_continuing_resource_type():
470             Parameter 'type_of_continuing_resource' has bad value.
471             Value: %s
472             Parameter 'type_of_continuing_resource' is required.
473             Parameter 'type_of_continuing_resource' length is bad.
474             Length: %s
475             Value: %s
476             Expected length: 1
477             Parameter 'type_of_continuing_resource' must be a scalar value.
478             Reference: %s
479             From Data::MARC::Field008::Utils::check_government_publication():
480             Parameter 'government_publication' has bad value.
481             Value: %s
482             Parameter 'government_publication' is required.
483             Parameter 'government_publication' length is bad.
484             Length: %s
485             Value: %s
486             Expected length: 1
487             Parameter 'government_publication' must be a scalar value.
488             Reference: %s
489             From Data::MARC::Field008::Utils::check_item_form():
490             Parameter 'form_of_item' has bad value.
491             Value: %s
492             Parameter 'form_of_item' is required.
493             Parameter 'form_of_item' length is bad.
494             Length: %s
495             Value: %s
496             Expected length: 1
497             Parameter 'form_of_item' must be a scalar value.
498             Reference: %s
499              
500             =head1 EXAMPLE
501              
502             =for comment filename=create_and_dump_marc_field_008_continuing_resource_material.pl
503              
504             use strict;
505             use warnings;
506              
507             use Data::Printer;
508             use Data::MARC::Field008::ContinuingResource;
509              
510             # cnb000002514
511             my $obj = Data::MARC::Field008::ContinuingResource->new(
512             'conference_publication' => '0',
513             'entry_convention' => '|',
514             'form_of_item' => ' ',
515             'form_of_original_item' => ' ',
516             'frequency' => 'z',
517             'government_publication' => 'u',
518             'nature_of_content' => ' ',
519             'nature_of_entire_work' => ' ',
520             'original_alphabet_or_script_of_title' => ' ',
521             # 89012345678901234
522             'raw' => 'zr u0 |',
523             'regularity' => 'r',
524             'type_of_continuing_resource' => ' ',
525             );
526              
527             # Print out.
528             p $obj;
529              
530             # Output:
531             # Data::MARC::Field008::ContinuingResource {
532             # parents: Mo::Object
533             # public methods (16):
534             # BUILD
535             # Data::MARC::Field008::Utils:
536             # check_conference_publication, check_continuing_resource_entry_convention, check_continuing_resource_form_of_original_item, check_continuing_resource_frequency, check_continuing_resource_nature_of_content, check_continuing_resource_nature_of_entire_work, check_continuing_resource_original_alphabet_or_script, check_continuing_resource_regularity, check_continuing_resource_type, check_government_publication, check_item_form
537             # Error::Pure:
538             # err
539             # Error::Pure::Utils:
540             # err_get
541             # Mo::utils:
542             # check_length_fix, check_required
543             # private methods (0)
544             # internals: {
545             # conference_publication 0,
546             # entry_convention "|",
547             # form_of_item " ",
548             # form_of_original_item " ",
549             # frequency "z",
550             # government_publication "u",
551             # nature_of_content " ",
552             # nature_of_entire_work " ",
553             # original_alphabet_or_script_of_title " ",
554             # raw "zr u0 |",
555             # regularity "r",
556             # type_of_continuing_resource " "
557             # }
558             # }
559              
560             =head1 DEPENDENCIES
561              
562             L<Data::MARC::Field008::Utils>,
563             L<Error::Pure>
564             L<Error::Pure::Utils>
565             L<Mo>,
566             L<Mo::utils>.
567              
568             =head1 REPOSITORY
569              
570             L<https://github.com/michal-josef-spacek/Data-MARC-Field008>
571              
572             =head1 AUTHOR
573              
574             Michal Josef Špaček L<mailto:skim@cpan.org>
575              
576             L<http://skim.cz>
577              
578             =head1 LICENSE AND COPYRIGHT
579              
580             © 2025 Michal Josef Špaček
581              
582             BSD 2-Clause License
583              
584             =head1 ACKNOWLEDGEMENTS
585              
586             Development of this software has been made possible by institutional support
587             for the long-term strategic development of the National Library of the Czech
588             Republic as a research organization provided by the Ministry of Culture of
589             the Czech Republic (DKRVO 2024–2028), Area 11: Linked Open Data.
590              
591             =head1 VERSION
592              
593             0.04
594              
595             =cut