Hi Robin By default all repeated subfields get joined by empty space, you can set this with the 'join' option:
marc_map('650v','subject',join:'%%%') gives you: "subject","Pictorial works%%%Juvenile" Or, if you have many 650 fields they are all joined into one string: "subject","Pictorial works%%%Juvenile%%%foo%%%bar%%%test" With the split_field command you can turn this again into an array: split_field('subject','%%%') gives you "subject",["Pictorial works","Juvenile","foo","bar","test"] Cheers Patrick PS. Indeed, the marc_map.pl is a bit cryptic. We are compiling perl scripts to make the executing much faster. The developers are now figuring out how to refactor this compilation out so that the Fix packages are easier to read. ________________________________________ From: Robin Sheat [ro...@catalyst.net.nz] Sent: Friday, June 06, 2014 5:11 AM To: perl4lib Subject: Converting MARC fields with Catmandu - repeated subfields being squished together. I'm using catmandu to JSON-ise MARC records for storage in Elasticsearch, and seem to have come up with something that I can't readily see how to fix (without getting down and dirty with fixers.) I have a record that has this: ["650"," ","0","a","Time","v","Pictorial works","v","Juvenile literature.","9","15531"] and a mapping: marc_map('650v', 'subject.$append') This works well enough in most cases, however when the subfield is doubled up, I end up with: "subject":["Time","Pictorial worksJuvenile literature."] The $append doesn't seem to apply in this case. This only seems to happen to repeats within a field, other 650$v subfields are in their own strings, though suffer the same problem. Is this a bug in Catmandu-MARC? I've tried reading the marc_map.pl file, but the lack of internal documentation, and the nature of what it's doing make it not the easiest thing to understand. -- Robin Sheat Catalyst IT Ltd. ✆ +64 4 803 2204 GPG: 5FA7 4B49 1E4D CAA4 4C38 8505 77F5 B724 F871 3BDF