2 A proposed perl data structure for storing marc info
5 $record is a hash reference
11 $tags is a hash reference
14 $tags->{$tag}->{$tagorder}
15 $tags->{$tag}->{$tagorder}->{indicator}='04'
16 $tags->{$tag}->{$tagorder}->{tagid}=573498
17 $tags->{$tag}->{$tagorder}->{subfields}=$subfields
19 $subfields is a hash reference
22 $subfields->{$mark}->{$subfieldorder}
23 $subfields->{$mark}->{$subfieldorder}='MacDonald, John A.'
27 110 ## $afirst text $asecond text $bthird text
29 120 01 $nno, another text
31 in perlmarcstructure, it can be writen :
32 $record->{bibid}=58973
33 $record->{tags}->{110}->{1}->{indicator}='##';
34 $record->{tags}->{110}->{1}->->{a}->{1}='first text';
35 $record->{tags}->{110}->{1}->{a}->{2}='second text';
36 $record->{tags}->{110}->{1}->{b}->{1}='third text';
38 $record->{tags}->{120}->{1}->{indicator}='##';
39 $record->{tags}->{120}->{1}->{a}->{1}='last text ??';
41 $record->{tags}->{120}->{2}->{indicator}='01';
42 $record->{tags}->{120}->{2}->{n}->{1}='no, another text';
45 This takes care of possible repeating tags and subfields as well as ordering of
46 tags and subfields, but it makes it difficult to look up specific tags and
47 subfields without looping through every time. It might be an idea to add an
48 index to the structure to aid these lookups.
50 $record->{index}->{110}->{tags}=\(3,4) <-- array ref shows that tags 3 and 4
53 Need a similar index for subfields.... I'm not sure if this is any simpler than
54 just looping through the tags every time. :)
56 I think looping is the way to go...
58 This still needs more work. This will also require an API for accessing or
59 modifying this structure, as it is non-trivial to parse the data. I'm also
60 starting to wonder how difficult it is going to be to develop templates using
61 this kind of structure. HTML::Template has no facility for parsing this kind
62 of data structure. We might need an alternate (or completely different) data
63 structure that is parseable by HTML::Template.