13 @ISA = qw(MARC::Record);
17 my $class = ref($proto) || $proto;
20 $self->{_mfhd_CAPTIONS} = {};
21 $self->{_mfhd_COMPRESSIBLE} = (substr($self->leader, 17, 1) =~ /[45]/);
23 foreach my $field ('853', '854', '855') {
25 foreach my $caption ($self->field($field)) {
28 $cap_id = $caption->subfield('8') || '0';
29 print "handling caption '$cap_id'\n";
31 if (exists $captions->{$cap_id}) {
32 carp "Multiple MFHD captions with label '$cap_id'";
35 $captions->{$cap_id} = new MFHD::Caption($caption);
36 if ($self->{_mfhd_COMPRESSIBLE}) {
37 $self->{_mfhd_COMPRESSIBLE} &&= $captions->{$cap_id}->compressible;
40 $self->{_mfhd_CAPTIONS}->{$field} = $captions;
43 foreach my $field ('863', '864', '865') {
47 ($cap_field = $field) =~ s/6/5/;
49 foreach my $hfield ($self->field($field)) {
50 my ($linkage, $link_id, $seqno);
53 $linkage = $hfield->subfield('8');
54 ($link_id, $seqno) = split(/\./, $linkage);
56 if (!exists $holdings->{$link_id}) {
57 $holdings->{$link_id} = {};
59 $holding = new MFHD::Holding($seqno, $hfield,
60 $self->{_mfhd_CAPTIONS}->{$cap_field}->{$link_id});
61 $holdings->{$link_id}->{$seqno} = $holding;
63 if ($self->{_mfhd_COMPRESSIBLE}) {
64 $self->{_mfhd_COMPRESSIBLE} &&= $holding->validate;
67 $self->{_mfhd_HOLDINGS}->{$field} = $holdings;
70 bless ($self, $class);
77 return $self->{_mfhd_COMPRESSIBLE};
84 return sort keys %{$self->{_mfhd_CAPTIONS}->{$field}}
92 return sort {$a->seqno <=> $b->seqno} values %{$self->{_mfhd_HOLDINGS}->{$field}->{$capid}};