NAME
MARC::Leader - MARC leader class.
SYNOPSIS
use MARC::Leader;
my $obj = MARC::Leader->new(%params);
my $leader_obj = $obj->parse(leader_str);
my $leader_str = $obj->serialize($leader_obj);
METHODS
new
my $obj = MARC::Leader->new(%params);
Constructor.
Returns instance of object.
parse
my $leader_obj = $obj->parse(leader_str);
Parse MARC leader string to object.
Returns instance of 'Data::MARC::Leader' object.
serialize
my $leader_str = $obj->serialize($leader_obj);
Serialize MARC leader object to string.
Returns string.
ERRORS
new():
From Class::Utils::set_params():
Unknown parameter '%s'.
serialize():
Bad 'Data::MARC::Leader' instance to serialize.
EXAMPLE1
use strict;
use warnings;
use Data::Printer;
use MARC::Leader;
if (@ARGV < 1) {
print "Usage: $0 marc_leader\n";
exit 1;
}
my $marc_leader = $ARGV[0];
# Object.
my $obj = MARC::Leader->new;
# Parse.
my $leader_obj = $obj->parse($marc_leader);
# Dump to output.
p $leader_obj;
# Output for '02200cem a2200541 i 4500':
# Data::MARC::Leader {
# parents: Mo::Object
# public methods (3):
# BUILD
# Mo::utils:
# check_strings
# Readonly:
# Readonly
# private methods (0)
# internals: {
# bibliographic_level "m",
# char_encoding_scheme "a",
# data_base_addr 541,
# descriptive_cataloging_form "i",
# encoding_level " ",
# impl_def_portion_len 0,
# indicator_count 2,
# length 2200,
# length_of_field_portion_len 4,
# multipart_resource_record_level " ",
# starting_char_pos_portion_len 5,
# status "c",
# subfield_code_count 2,
# type "e",
# type_of_control " ",
# undefined 0
# }
# }
EXAMPLE2
use strict;
use warnings;
use Data::MARC::Leader;
use MARC::Leader;
# Object.
my $obj = MARC::Leader->new;
# Data object.
my $data_marc_leader = Data::MARC::Leader->new(
'bibliographic_level' => 'm',
'char_encoding_scheme' => 'a',
'data_base_addr' => 541,
'descriptive_cataloging_form' => 'i',
'encoding_level' => ' ',
'impl_def_portion_len' => '0',
'indicator_count' => '2',
'length' => 2200,
'length_of_field_portion_len' => '4',
'multipart_resource_record_level' => ' ',
'starting_char_pos_portion_len' => '5',
'status' => 'c',
'subfield_code_count' => '2',
'type' => 'e',
'type_of_control' => ' ',
'undefined' => '0',
);
# Serialize.
my $leader = $obj->serialize($data_marc_leader);
# Print to output.
print $leader."\n";
# Output:
# 02200cem a2200541 i 4500
DEPENDENCIES
Class::Utils, Data::MARC::Leader, Error::Pure, Scalar::Util.
SEE ALSO
- Data::MARC::Leader
-
Data object for MARC leader.
REPOSITORY
https://github.com/michal-josef-spacek/MARC-Leader
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2023 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.02