Re: Converting MARC fields with Catmandu - repeated subfields being squished together.

[email protected] (Robin Sheat) Mon, 09 Jun 2014 14:58:32 +1200
Newsgroups perl.perl4lib
Organization Catalyst IT Ltd.
Message-ID <[email protected]>
--=-AYpJ16rWFou6SwvlcTB9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Robin Sheat schreef op ma 09-06-2014 om 14:50 [+1200]:
> $ cat test.fixes
> marc_map('650','subject',join:'###');
> remove_field('record');

Ah, I found that I need to change the syntax a bit:

marc_map('650','subject', -split =3D> 1);=20

gives me:

{"subject":[["Counting","Pictorial works","Juvenile
literature."],["English language","Alphabet","Pictorial works","Juvenile
literature.","14467"],["Time","Pictorial works","Juvenile
literature.","15531"],["Children's stories, English","Pictorial
works."]],"_id":"5567128"}

which is closer. Is there an easy way to flatten those arrays?

Otherwise I can go with join and the split, but this way seems cleaner.

Actually, I wonder if nested arrays would work even better for my
purposes, I guess I should test it...

--=20
Robin Sheat
Catalyst IT Ltd.
=E2=9C=86 +64 4 803 2204
GPG: 5FA7 4B49 1E4D CAA4 4C38  8505 77F5 B724 F871 3BDF

--=-AYpJ16rWFou6SwvlcTB9
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iQEcBAABCgAGBQJTlSLYAAoJEHf1tyT4cTvfnF8H/1Ux6dsxBCR50LqaXHgiY6FY
TVkPeUlUEMac3aAO/Bhno9jgXkoAQlkF6k3b+fOGsbxAwEJyWqKu+Ahxb/aQ4u29
tThre05Y8s63Sy1OgaOTTU3A9pIK4xrP3Ist9IYhLIQvzmb6QvMbTtWbhbho4Gxm
h1q2lF9/rlx8D7sITURnO9M6kaJJHXcfU9ynmuXMc6d/4jjmCqvgGDF0cLqWIf4C
+tAt54JMUN7QROl9KkfQLemNyJJ4WOnPRCjNqsmRh+S1Xrrfo0ku7GK0oB0HUx6X
VmEPHE3dfbPo27k3haj4Z7azYUW9c/SsqLfo+jsbyx3bun5OEZGPavhtACT13f4=
=fPIT
-----END PGP SIGNATURE-----

--=-AYpJ16rWFou6SwvlcTB9--