10 my $class = ref($proto) || $proto;
15 my $last_enum = undef;
17 $self->{SEQNO} = $seqno;
18 $self->{HOLDING} = $holding;
19 $self->{CAPTION} = $caption;
23 $self->{COPY} = undef;
24 $self->{BREAK} = undef;
26 $self->{COPYRIGHT} = [];
28 foreach my $subfield ($holding->subfields) {
29 my ($key, $val) = @$subfield;
30 if ($key =~ /[a-h]/) {
31 # Enumeration details of holdings
32 $self->{ENUMS}->{$key} = {HOLDINGS => $val,
35 } elsif ($key =~ /[i-m]/) {
36 $self->{CHRON}->{$key} = $val;
37 if (!exists $caption->{CHRONS}->{$key}) {
38 carp "Holding specified enumeration level '$key' not included in caption $caption->{LINK}";
40 } elsif ($key eq 'o') {
41 carp '$o specified prior to first enumeration'
42 unless defined($last_enum);
43 $self->{ENUMS}->{$last_enum}->{UNIT} = $val;
45 } elsif ($key =~ /[npq]/) {
46 $self->{DESCR}->{$key} = $val;
47 } elsif ($key eq 's') {
48 push @{$self->{COPYRIGHT}}, $val;
49 } elsif ($key eq 't') {
51 } elsif ($key eq 'w') {
52 carp "Unrecognized break indicator '$val'"
53 unless $val =~ /^[gn]$/;
54 $self->{BREAK} = $val;
58 bless ($self, $class);
64 my $caption = $self->{CAPTION};
67 foreach my $key ('a'..'f') {
68 last if !exists $caption->{ENUMS}->{$key};
69 # printf("fmt %s: '%s'\n", $key, $caption->caption($key));
71 $str .= ($key eq 'a' ? "" : ':') . $caption->caption($key) . $self->{ENUMS}->{$key}->{HOLDINGS};
74 if (exists $caption->{ENUMS}->{'g'}) {
75 # There's at least one level of alternative enumeration
77 foreach my $key ('g', 'h') {
78 $str .= ($key eq 'g' ? '' : ':') . $caption->enum($key) . $self->{ENUMS}->{$key}->{HOLDINGS};
87 my $caption = $self->{CAPTION};