blib/lib/MARC/Field008.pm

filter: Statementstmt 94.3% 116 / 123 Branchbran 74.0% 37 / 50 Conditioncond 88.8% 8 / 9 MC/DCmcdc 83.3% 5 / 6 Subroutinesub 100% 26 / 26 Podpod 100% 3 / 3 totaltotal 89.8% 195 / 217 CC 29 SCAR 21.3
CC
29
Cov
88%
_parse_different
20.0
_serialize_different
8.1
parse
4.0
CRAP 8.4
↑ Summary
1 package MARC::Field008;
2  
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use Class::Utils qw(set_params);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use Data::MARC::Field008;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use Data::MARC::Field008::Book 0.03;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use Data::MARC::Field008::ComputerFile 0.03;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use Data::MARC::Field008::ContinuingResource 0.03;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use Data::MARC::Field008::Map 0.03;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 5 ▶use Data::MARC::Field008::MixedMaterial 0.03;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 5 ▶use Data::MARC::Field008::Music 0.03;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 5 ▶use Data::MARC::Field008::VisualMaterial 0.03;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 5 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
16 5 ▶use List::Util 1.33 qw(any);
Subroutine BEGIN: called CC=1 SCAR=0.0
17 5 ▶use Mo::utils 0.08 qw(check_bool check_isa check_required);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 5 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 5 our $VERSION = 0.04;
21  
22 # Constructor.
23 sub new {
24 21 ▶ my ($class, @params) = @_;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
25  
26 # Create object.
27 21 my $self = bless {}, $class;
28  
29 # Ignore data errors.
30 21 $self->{'ignore_data_errors'} = 0;
31  
32 # Leader.
33 21 $self->{'leader'} = undef;
34  
35 # Verbose mode.
36 21 $self->{'verbose'} = 0;
37  
38 # Process parameters.
39 21 set_params($self, @params);
40  
41 # Check 'ignore_data_errors'.
42 21 check_required($self, 'ignore_data_errors');
43 21 check_bool($self, 'ignore_data_errors');
44  
45 # Check 'leader'.
46 20 check_isa($self, 'leader', 'Data::MARC::Leader');
47  
48 # Check 'verbose'.
49 18 check_bool($self, 'verbose');
50  
51 18 return $self;
52 }
53  
54 sub parse {
55 15 ▶ my ($self, $field_008) = @_;
Subroutine parse: called CC=4 SCAR=13.9
Pod documented
56  
57 # Parameter 'leader' is required for parse().
58 15 check_required($self, 'leader');
59  
60 # XXX Fix white space issue in MARC XML record.
61 14 ▶ if (length($field_008) < 40) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $field_008 < 40) 2 12 14
62 2 $field_008 .= (' ' x (40 - length($field_008)));
63 }
64  
65 # Check length.
66 14 ▶ if (length($field_008) > 40) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $field_008 > 40) 1 13 14
67 1 err 'Bad length of MARC 008 field.',
68 'Length', length($field_008),
69 ;
70 }
71 13 ▶ if ($self->{'verbose'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"verbose"}) 0 13 13
72 0 print "Field 008: |$field_008|\n";
73 }
74  
75 13 my %params = (
76 'raw' => $field_008,
77  
78 'date_entered_on_file' => (substr $field_008, 0, 6),
79 'type_of_date' => (substr $field_008, 6, 1),
80 'date1' => (substr $field_008, 7, 4),
81 'date2' => (substr $field_008, 11, 4),
82 'place_of_publication' => (substr $field_008, 15, 3),
83 $self->_parse_different($field_008),
84 'language' => (substr $field_008, 35, 3),
85 'modified_record' => (substr $field_008, 38, 1),
86 'cataloging_source' => (substr $field_008, 39, 1),
87 );
88  
89 13 return Data::MARC::Field008->new(%params);
90 }
91  
92 sub serialize {
93 8 ▶ my ($self, $field_008_obj) = @_;
Subroutine serialize: called CC=3 SCAR=11.0
Pod documented
94  
95 # Check object.
96 8 ▶ if (! blessed($field_008_obj) || ! $field_008_obj->isa('Data::MARC::Field008')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($field_008_obj) and $field_008_obj->isa("Data::MARC::Field008")) 2 6 8
Condition100%3/3
builtin::blessed($field_008_obj) and $field_008_obj->isa("Data::MARC::Field008")
!ll&&!rl&&r
116
MC/DC100%2/2
builtin::blessed($field_008_obj) and $field_008_obj->isa("Data::MARC::Field008")
builtin::blessed($field_008_obj) $field_008_obj->isa("Data::MARC::Field008")
Truth table100%3/3
A and B
A= builtin::blessed($field_008_obj)B= $field_008_obj->isa("Data::MARC::Field008")
ABresult
0X0
100
111
97 2 err "Bad 'Data::MARC::Field008' instance to serialize.";
98 }
99  
100 6 my $field_008 = $field_008_obj->date_entered_on_file.
101 $field_008_obj->type_of_date.
102 $field_008_obj->date1.
103 $field_008_obj->date2.
104 $field_008_obj->place_of_publication.
105 $self->_serialize_different($field_008_obj->material).
106 $field_008_obj->language.
107 $field_008_obj->modified_record.
108 $field_008_obj->cataloging_source;
109  
110 6 return $field_008;
111 }
112  
113 sub _parse_different {
114 13 ▶ my ($self, $field_008) = @_;
Subroutine _parse_different: called CC=17 SCAR=30.0
115  
116 13 my %params;
117  
118 # Book
119 13 ▶ if ((any { $self->{'leader'}->type eq $_ } qw(a t))
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 7 branches
BranchTrueFalseTotal
if (&any(sub { $self->{'leader'}->type eq $_; } , 'a', 't') and &any(sub { $self->{'leader'}->bibliographic_level eq $_; } , 'a', 'c', 'd', 'm')) { } 3 10 13
elsif ($self->{'leader'}->type eq 'm') { } 2 8 10
elsif (&any(sub { $self->{'leader'}->type eq $_; } , 'e', 'f')) { } 2 6 8
elsif (&any(sub { $self->{'leader'}->type eq $_; } , 'c', 'd', 'i', 'j')) { } 2 4 6
elsif ($self->{'leader'}->type eq 'a' and &any(sub { $self->{'leader'}->bibliographic_level eq $_; } , 'b', 'i', 's')) { } 2 2 4
elsif (&any(sub { $self->{'leader'}->type eq $_; } , 'g', 'k', 'o', 'r')) { } 2 0 2
elsif ($self->{'leader'}->type eq 'p') { } 0 0 0
Condition100%3/3
&any(sub { and &any(sub {
!ll&&!rl&&r
823
MC/DC100%2/2
&any(sub { $self->{"leader"}->type eq $_; } , "a", "t") and &any(sub { $self->{"leader"}->bibliographic_level eq $_; } , "a", "c", "d", "m")
&any(sub { $self->{"leader"}->type eq $_; } , "a", "t") &any(sub { $self->{"leader"}->bibliographic_level eq $_; } , "a", "c", "d", "m")
Truth table100%3/3
A and B
A= &any(sub { $self->{"leader"}->type eq $_; } , "a", "t")B= &any(sub { $self->{"leader"}->bibliographic_level eq $_; } , "a", "c", "d", "m")
ABresult
0X0
100
111
120 20 ▶ && (any { $self->{'leader'}->bibliographic_level eq $_ } qw(a c d m))) {
Subroutine __ANON__: called CC=1 SCAR=0.0
121  
122 3 my %mat_params = (
123 'illustrations' => substr($field_008, 18, 4),
124 'target_audience' => substr($field_008, 22, 1),
125 'form_of_item' => substr($field_008, 23, 1),
126 'nature_of_content' => substr($field_008, 24, 4),
127 'government_publication' => substr($field_008, 28, 1),
128 'conference_publication' => substr($field_008, 29, 1),
129 'festschrift' => substr($field_008, 30, 1),
130 'index' => substr($field_008, 31, 1),
131 'literary_form' => substr($field_008, 33, 1),
132 'biography' => substr($field_008, 34, 1),
133  
134 'raw' => substr($field_008, 18, 17),
135 );
136 3 ▶ $Data::MARC::Field008::Book::STRICT = $self->{'ignore_data_errors'} ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'ignore_data_errors'} ? : 1 2 3
137 3 my $material = Data::MARC::Field008::Book->new(%mat_params);
138 3 %params = (
139 'material' => $material,
140 'material_type' => 'book',
141 );
142  
143 # Computer files.
144 } elsif ($self->{'leader'}->type eq 'm') {
145 2 my %mat_params = (
146 'target_audience' => substr($field_008, 22, 1),
147 'form_of_item' => substr($field_008, 23, 1),
148 'type_of_computer_file' => substr($field_008, 26, 1),
149 'government_publication' => substr($field_008, 28, 1),
150  
151 'raw' => substr($field_008, 18, 17),
152 );
153 2 ▶ $Data::MARC::Field008::ComputerFile::STRICT = $self->{'ignore_data_errors'} ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'ignore_data_errors'} ? : 0 2 2
154 2 my $material = Data::MARC::Field008::ComputerFile->new(%mat_params);
155 2 %params = (
156 'material' => $material,
157 'material_type' => 'computer_file',
158 );
159  
160 # Maps.
161 14 ▶ } elsif (any { $self->{'leader'}->type eq $_ } qw(e f)) {
Subroutine __ANON__: called CC=1 SCAR=0.0
162 2 my %mat_params = (
163 'relief' => substr($field_008, 18, 4),
164 'projection' => substr($field_008, 22, 2),
165 'type_of_cartographic_material' => substr($field_008, 25, 1),
166 'government_publication' => substr($field_008, 28, 1),
167 'form_of_item' => substr($field_008, 29, 1),
168 'index' => substr($field_008, 31, 1),
169 'special_format_characteristics' => substr($field_008, 33, 2),
170  
171 'raw' => substr($field_008, 18, 17),
172 );
173 2 ▶ $Data::MARC::Field008::Map::STRICT = $self->{'ignore_data_errors'} ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'ignore_data_errors'} ? : 0 2 2
174 2 my $material = Data::MARC::Field008::Map->new(%mat_params);
175 2 %params = (
176 'material' => $material,
177 'material_type' => 'map',
178 );
179  
180 # Music.
181 18 ▶ } elsif (any { $self->{'leader'}->type eq $_ } qw(c d i j)) {
Subroutine __ANON__: called CC=1 SCAR=0.0
182 2 my %mat_params = (
183 'form_of_composition' => substr($field_008, 18, 2),
184 'format_of_music' => substr($field_008, 20, 1),
185 'music_parts' => substr($field_008, 21, 1),
186 'target_audience' => substr($field_008, 22, 1),
187 'form_of_item' => substr($field_008, 23, 1),
188 'accompanying_matter' => substr($field_008, 24, 6),
189 'literary_text_for_sound_recordings' => substr($field_008, 30, 2),
190 'transposition_and_arrangement' => substr($field_008, 33, 1),
191  
192 'raw' => substr($field_008, 18, 17),
193 );
194 2 ▶ $Data::MARC::Field008::Music::STRICT = $self->{'ignore_data_errors'} ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'ignore_data_errors'} ? : 0 2 2
195 2 my $material = Data::MARC::Field008::Music->new(%mat_params);
196 2 %params = (
197 'material' => $material,
198 'material_type' => 'music',
199 );
200  
201 # Continuing Resources
202 ▶ } elsif ($self->{'leader'}->type eq 'a'
Condition66%2/3
$self->{"leader"}->type eq "a" and &any(sub {
!ll&&!rl&&r
202
MC/DC50%1/2
$self->{"leader"}->type eq "a" and &any(sub { $self->{"leader"}->bibliographic_level eq $_; } , "b", "i", "s")
$self->{"leader"}->type eq "a" &any(sub { $self->{"leader"}->bibliographic_level eq $_; } , "b", "i", "s")
Truth table66%2/3
A and B
A= $self->{"leader"}->type eq "a"B= &any(sub { $self->{"leader"}->bibliographic_level eq $_; } , "b", "i", "s")
ABresult
0X0
100
111
203 6 ▶ && (any { $self->{'leader'}->bibliographic_level eq $_ } qw(b i s))) {
Subroutine __ANON__: called CC=1 SCAR=0.0
204  
205 2 my %mat_params = (
206 'frequency' => substr($field_008, 18, 1),
207 'regularity' => substr($field_008, 19, 1),
208 'type_of_continuing_resource' => substr($field_008, 21, 1),
209 'form_of_original_item' => substr($field_008, 22, 1),
210 'form_of_item' => substr($field_008, 23, 1),
211 'nature_of_entire_work' => substr($field_008, 24, 1),
212 'nature_of_content' => substr($field_008, 25, 3),
213 'government_publication' => substr($field_008, 28, 1),
214 'conference_publication' => substr($field_008, 29, 1),
215 'original_alphabet_or_script_of_title' => substr($field_008, 33, 1),
216 'entry_convention' => substr($field_008, 34, 1),
217  
218 'raw' => substr($field_008, 18, 17),
219 );
220 2 ▶ $Data::MARC::Field008::ContinuingResource::STRICT = $self->{'ignore_data_errors'} ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'ignore_data_errors'} ? : 0 2 2
221 2 my $material = Data::MARC::Field008::ContinuingResource->new(%mat_params);
222 2 %params = (
223 'material' => $material,
224 'material_type' => 'continuing_resource',
225 );
226  
227 # Visual Materials
228 4 ▶ } elsif (any { $self->{'leader'}->type eq $_ } qw(g k o r)) {
Subroutine __ANON__: called CC=1 SCAR=0.0
229 2 my %mat_params = (
230 'running_time_for_motion_pictures_and_videorecordings' => substr($field_008, 18, 3),
231 'target_audience' => substr($field_008, 22, 1),
232 'government_publication' => substr($field_008, 28, 1),
233 'form_of_item' => substr($field_008, 29, 1),
234 'type_of_visual_material' => substr($field_008, 33, 1),
235 'technique' => substr($field_008, 34, 1),
236  
237 'raw' => substr($field_008, 18, 17),
238 );
239 2 ▶ $Data::MARC::Field008::VisualMaterial::STRICT = $self->{'ignore_data_errors'} ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'ignore_data_errors'} ? : 0 2 2
240 2 my $material = Data::MARC::Field008::VisualMaterial->new(%mat_params);
241 2 %params = (
242 'material' => $material,
243 'material_type' => 'visual_material',
244 );
245  
246 # Mixed Materials
247 } elsif ($self->{'leader'}->type eq 'p') {
248 0 my %mat_params = (
249 'form_of_item' => substr($field_008, 23, 1),
250  
251 'raw' => substr($field_008, 18, 17),
252 );
253 0 ▶ $Data::MARC::Field008::MixedMaterial::STRICT = $self->{'ignore_data_errors'} ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'ignore_data_errors'} ? : 0 0 0
254 0 my $material = Data::MARC::Field008::MixedMaterial->new(%mat_params);
255 0 %params = (
256 'material' => $material,
257 'material_type' => 'mixed_material',
258 );
259  
260 } else {
261 0 err "Unsupported 008 type.";
262 }
263  
264 13 return %params;
265 }
266  
267 sub _serialize_different {
268 6 ▶ my ($self, $material) = @_;
Subroutine _serialize_different: called CC=8 SCAR=20.9
269  
270 6 my $ret;
271 6 ▶ if ($material->isa('Data::MARC::Field008::Book')) {
Branch: 7 branches
BranchTrueFalseTotal
if ($material->isa('Data::MARC::Field008::Book')) { } 1 5 6
elsif ($material->isa('Data::MARC::Field008::ComputerFile')) { } 1 4 5
elsif ($material->isa('Data::MARC::Field008::ContinuingResource')) { } 1 3 4
elsif ($material->isa('Data::MARC::Field008::Map')) { } 1 2 3
elsif ($material->isa('Data::MARC::Field008::MixedMaterial')) { } 0 2 2
elsif ($material->isa('Data::MARC::Field008::Music')) { } 1 1 2
elsif ($material->isa('Data::MARC::Field008::VisualMaterial')) { } 1 0 1
272 1 $ret = $material->illustrations.
273 $material->target_audience.
274 $material->form_of_item.
275 $material->nature_of_content.
276 $material->government_publication.
277 $material->conference_publication.
278 $material->festschrift.
279 $material->index.
280 ' '.
281 $material->literary_form.
282 $material->biography;
283  
284 } elsif ($material->isa('Data::MARC::Field008::ComputerFile')) {
285 1 $ret = (' ' x 4).
286 $material->target_audience.
287 $material->form_of_item.
288 (' ' x 2).
289 $material->type_of_computer_file.
290 ' '.
291 $material->government_publication.
292 (' ' x 6);
293 } elsif ($material->isa('Data::MARC::Field008::ContinuingResource')) {
294 1 $ret = $material->frequency.
295 $material->regularity.
296 ' '.
297 $material->type_of_continuing_resource.
298 $material->form_of_original_item.
299 $material->form_of_item.
300 $material->nature_of_entire_work.
301 $material->nature_of_content.
302 $material->government_publication.
303 $material->conference_publication.
304 (' ' x 3).
305 $material->original_alphabet_or_script_of_title.
306 $material->entry_convention;
307 } elsif ($material->isa('Data::MARC::Field008::Map')) {
308 1 $ret = $material->relief.
309 $material->projection.
310 ' '.
311 $material->type_of_cartographic_material.
312 (' ' x 2).
313 $material->government_publication.
314 $material->form_of_item.
315 ' '.
316 $material->index.
317 ' '.
318 $material->special_format_characteristics;
319 } elsif ($material->isa('Data::MARC::Field008::MixedMaterial')) {
320 0 $ret = (' ' x 5).
321 $material->form_of_item.
322 (' ' x 10);
323 } elsif ($material->isa('Data::MARC::Field008::Music')) {
324 1 $ret = $material->form_of_composition.
325 $material->format_of_music.
326 $material->music_parts.
327 $material->target_audience.
328 $material->form_of_item.
329 $material->accompanying_matter.
330 $material->literary_text_for_sound_recordings.
331 ' '.
332 $material->transposition_and_arrangement.
333 ' ';
334 } elsif ($material->isa('Data::MARC::Field008::VisualMaterial')) {
335 1 $ret = $material->running_time_for_motion_pictures_and_videorecordings.
336 ' '.
337 $material->target_audience.
338 (' ' x 5).
339 $material->government_publication.
340 $material->form_of_item.
341 (' ' x 3).
342 $material->type_of_visual_material.
343 $material->technique;
344 }
345  
346 6 return $ret;
347 }
348  
349 5 1;
350  
351 __END__
352  
353 =pod
354  
355 =encoding utf8
356  
357 =head1 NAME
358  
359 MARC::Field008 - Class for parsing and serialization of MARC field 008.
360  
361 =head1 SYNOPSIS
362  
363 use MARC::Field008;
364  
365 my $obj = MARC::Field008->new(%params);
366 my $data_obj = $cnf->parse($field_008);
367 my $field_008 = $cnf->serialize($data_obj);
368  
369 =head1 METHODS
370  
371 =head2 C<new>
372  
373 my $obj = MARC::Field008->new(%params);
374  
375 Constructor.
376  
377 =over 8
378  
379 =item * C<ignore_data_errors>
380  
381 Flag for ignoring material object errors.
382  
383 It's required.
384  
385 Default value is 0.
386  
387 =item * C<leader>
388  
389 MARC leader in L<Data::MARC::Leader> instance.
390  
391 It's required for parse() method only.
392  
393 Default is undef.
394  
395 =item * C<verbose>
396  
397 Verbose mode.
398  
399 Default is 0.
400  
401 =back
402  
403 Returns instance of object.
404  
405 =head2 C<parse>
406  
407 my $data_obj = $cnf->parse($field_008);
408  
409 Parse MARC field 008 string to data object.
410  
411 Returns instance of L<Data::MARC::Field008>.
412  
413 =head2 C<serialize>
414  
415 my $field_008 = $cnf->serialize($data_obj);
416  
417 Serialize L<Data::MARC::Field008> object to string..
418  
419 Returns string.
420  
421 =head1 ERRORS
422  
423 new():
424 From Mo::utils::check_bool():
425 Parameter 'ignore_data_errors' must be a bool (0/1).
426 Value: %s
427 Parameter 'verbose' must be a bool (0/1).
428 Value: %s
429 From Mo::utils::check_isa():
430 Parameter 'leader' must be a 'Data::MARC::Leader' object.
431 Value: %s
432 Reference: %s
433 From Mo::utils::check_required():
434 Parameter 'ignore_data_errors' is required.
435 From Class::Utils::set_params():
436 Unknown parameter '%s'.
437  
438 parse():
439 Bad length of MARC 008 field.
440 Length: %s
441  
442 From Mo::utils::check_required():
443 Parameter 'leader' is required.
444  
445 Errors from L<Data::MARC::Field008>, see documentation.
446  
447 serialize():
448 Bad 'Data::MARC::Field008' instance to serialize.
449  
450 =head1 EXAMPLE1
451  
452 =for comment filename=parse_example.pl
453  
454 use strict;
455 use warnings;
456  
457 use MARC::Field008;
458 use MARC::Leader;
459 use Data::Printer;
460  
461 # Object.
462 my $leader = MARC::Leader->new->parse(' nam a22 4500');
463 my $obj = MARC::Field008->new(
464 'leader' => $leader,
465 );
466  
467 # Parse.
468 my $data = $obj->parse('830304s1982 xr a u0|0 | cze ');
469  
470 # Dump.
471 p $data;
472  
473 # Output:
474 # Data::MARC::Field008 {
475 # parents: Mo::Object
476 # public methods (13):
477 # BUILD
478 # Data::MARC::Field008::Utils:
479 # check_cataloging_source, check_date, check_modified_record, check_type_of_date
480 # Error::Pure:
481 # err
482 # Error::Pure::Utils:
483 # err_get
484 # Mo::utils:
485 # check_isa, check_length_fix, check_number, check_required, check_strings
486 # Readonly:
487 # Readonly
488 # private methods (0)
489 # internals: {
490 # cataloging_source " ",
491 # date_entered_on_file 830304,
492 # date1 1982,
493 # date2 " ",
494 # language "cze",
495 # material Data::MARC::Field008::Book,
496 # material_type "book",
497 # modified_record " ",
498 # place_of_publication "xr ",
499 # raw "830304s1982 xr a u0|0 | cze " (dualvar: 830304),
500 # type_of_date "s"
501 # }
502 # }
503  
504 =head1 EXAMPLE2
505  
506 =for comment filename=serialize_example.pl
507  
508 use strict;
509 use warnings;
510  
511 use MARC::Field008;
512 use MARC::Leader;
513 use Data::MARC::Field008;
514 use Data::MARC::Field008::Book;
515  
516 # Object.
517 my $leader = MARC::Leader->new->parse(' nam a22 4500');
518 my $obj = MARC::Field008->new(
519 'leader' => $leader,
520 );
521  
522 # Data.
523 my $material = Data::MARC::Field008::Book->new(
524 'biography' => ' ',
525 'conference_publication' => '0',
526 'festschrift' => '0',
527 'form_of_item' => 'r',
528 'government_publication' => ' ',
529 'illustrations' => ' ',
530 'index' => '0',
531 'literary_form' => '0',
532 'nature_of_content' => ' ',
533 'target_audience' => ' ',
534 );
535 my $data = Data::MARC::Field008->new(
536 'cataloging_source' => ' ',
537 'date_entered_on_file' => ' ',
538 'date1' => ' ',
539 'date2' => ' ',
540 'language' => 'cze',
541 'material' => $material,
542 'material_type' => 'book',
543 'modified_record' => ' ',
544 'place_of_publication' => ' ',
545 'type_of_date' => 's',
546 );
547  
548 # Serialize.
549 print "'".$obj->serialize($data)."'\n";
550  
551 # Output:
552 # ' s r 000 0 cze '
553  
554 =head1 DEPENDENCIES
555  
556 L<Class::Utils>,
557 L<Data::MARC::Field008>,
558 L<Data::MARC::Field008::Book>,
559 L<Data::MARC::Field008::ComputerFile>,
560 L<Data::MARC::Field008::ContinuingResource>,
561 L<Data::MARC::Field008::Map>,
562 L<Data::MARC::Field008::MixedMaterial>,
563 L<Data::MARC::Field008::Music>,
564 L<Data::MARC::Field008::VisualMaterial>,
565 L<Error::Pure>,
566 L<List::Util>,
567 L<Mo::utils>,
568 L<Scalar::Util>.
569  
570 =head1 SEE ALSO
571  
572 =over
573  
574 =item L<Data::MARC::Field008>
575  
576 Data object for MARC field 008.
577  
578 =back
579  
580 =head1 REPOSITORY
581  
582 L<https://github.com/michal-josef-spacek/MARC-Field008>
583  
584 =head1 AUTHOR
585  
586 Michal Josef Špaček L<mailto:skim@cpan.org>
587  
588 L<http://skim.cz>
589  
590 =head1 LICENSE AND COPYRIGHT
591  
592 © 2025 Michal Josef Špaček
593  
594 BSD 2-Clause License
595  
596 =head1 ACKNOWLEDGEMENTS
597  
598 Development of this software has been made possible by institutional support
599 for the long-term strategic development of the National Library of the Czech
600 Republic as a research organization provided by the Ministry of Culture of
601 the Czech Republic (DKRVO 2024–2028), Area 11: Linked Open Data.
602  
603 =head1 VERSION
604  
605 0.04
606  
607 =cut
↑ Summary