Ed Summers wrote:
Yeah, if you want an 008 you have to make it yourself. MARC::Record
will make no attempt to build an 008 automatically based on information
in the leader.

Hi guys,

I've been using MARC::Record to help with these fixed fields and I've been creating functions like this:

# 008/23 (Books, Music, Continuing Resources, Mixed Materials) or /29 (Maps, Visual Materials) - Form of item
# A one-character code that indicates the form of material for the item.
sub bib_form_of_item() {
my $self = shift;
my $text = shift;
my $field = $self->field('008');
if (!$field) { return undef; }
my $string = $field->as_string;
my $offset = "";
my $form = bib_form_of_material($self);
if ($form == FORM_MAPS or $form == FORM_VISUAL_MATERIALS) {
$offset = 29;
} else {
$offset = 23;
}
if ( defined $text ) {
( $text =~ /^(#|a|b|c|d|f|r|s|\|)$/ ) or $self->_warn( "Form of item must be '#', 'a', 'b', 'c', 'd', 'f', 'r', 's', or '|'." );
substr($string,$offset,1,$text);
my $replacement = MARC::Field->new('008', $string);
$self->delete_field($field);
$self->insert_grouped_field( $replacement );
$field = $self->field('008');
$string = $field->as_string;
}
return substr($string,$offset,1);
} # bib_form_of_item()


I'm not sure of the best way to package these. I know Ed has mentioned that he's not a fan of the bibliographic specific methods in MARC::Record, but I'm not well-versed in Perl OOP yet and couldn't figure out how to subclass MARC::Record. Right now I'm just creating a .pm file that claims to be a part of MARC::Record and makes use of some internals. If any of you are interested in any of this or have any suggestions, I'm willing to contribute. I only have a handful of functions at the moment for the Leader and the 008, but I'll be adding more.

Thanks,
Jason



Reply via email to