blib/lib/MARC/Field008.pm

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