RE: MARC::Record / MARC::File::XML bug when fields contain newlines?

[email protected] (Bryan Baldus) Thu, 12 Jan 2012 12:18:18 -0600
Newsgroups perl.perl4lib
Message-ID <AE5353CC4A55324E832DA208826294AC0105B0814913@QBIMAIL.qbi.quality-books.com>
On Thursday, January 12, 2012 11:59 AM, [email protected] [mailto:[email protected]]  wrote:
>I could have sworn I have processed MARC records containing newlines with no problems in the past (I.e., not records converted from XML), though I've never tried to validate them with MARCEdit.
...
>Looks like MARC::Record is doing its job correctly. Perhaps changing MARC::File::XML is in order.

MARC::File::USMARC includes a line in sub _next:

     # remove illegal garbage that sometimes occurs between records
    $usmarc =~ s/^[ \x00\x0a\x0d\x1a]+//;

If I remember correctly, I believe this was added a few years ago in response to similar questions about new lines appearing in records (or after someone experienced problems with new lines and/or end-of-file characters in files of records--the new line removal may have always been there; I think I may have added 1A after finding it in some files I was working with).

I'm not familiar with MARC::File::XML to know how it deals with end of line characters.

----

Bryan Baldus
Cataloger
Quality Books Inc.
The Best of America's Independent Presses
1-800-323-4241x402
[email protected]
[email protected]
http://home.comcast.net/~eijabb/