Re: sending marc records into a script that uses MARC::Batch

[email protected] (Robin Sheat) Fri, 30 May 2014 11:12:32 +1200
Newsgroups perl.perl4lib
Organization Catalyst IT Ltd.
Message-ID <[email protected]>
--=-rZz1zplAYWVvmxB82zNA
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

John E Guillory schreef op do 29-05-2014 om 21:13 [+0000]:
> =E2=80=9CWarnings detected: Entirely empty subfield found in tag 260=E2=
=80=9D

An entirely empty subfield is an illegally formatted thing, at least
according to the rules of MARC::Record/MARC::Field, and so I assume the
MARC format itself. So it's not that it's a required field or anything
like that, it's that the USMARC is incorrectly formatted, so the parser
throws an exception with 'die'.

To catch the exception rather than having your program terminate, you
need to wrap the call that's failing in an 'eval' block, and check for
errors after it, handling them appropriately. You might be lucky and the
file is OK and the parser can continue, however you might be unlucky and
this corrupt record causes the parser to get confused and it can't find
the start of the next record.

See 'perldoc -f eval' for more information on using it for
error/exception handling.

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

--=-rZz1zplAYWVvmxB82zNA
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)

iQEcBAABCgAGBQJTh77gAAoJEHf1tyT4cTvfnAoH/RCm4KF6hzXtx8Hd2OoD5uTT
wFE/YxF6JpvBUgVsQv8OzkzEbM8g8zi2EHGnYc53oRCoBM59Kf0WseunFx2IBHto
vl/nAlHCxQkYzCdjKyRsH5Ejv+wY50j4IuT7MjRVxqjf9SdLEJo+CnvyqMrJNeRu
b//Du0PIaX89v2/XzoA4aRi6hH0uVawd16dX/ZQGsxioWN+0zILX0Lp41JjFPwHK
pteLrx85O2eVK1LarNEZzWP5V9zZZZAS+fawxzUxSlF4eKZGB4RBU4ckswxCEANv
ugKFgAbosagERjK1DcsMUtdpGMh5/gRm5aSchAf2b8+xa0EwbmD57ZHsxdOgeiE=
=gWZs
-----END PGP SIGNATURE-----

--=-rZz1zplAYWVvmxB82zNA--