Print

Print


> How do I trap for unwanted (bogus) characters in MARC records?


Thank you for all of the interest, and a number of you have asked, "Show me a record." In that vein, I'm making the whole of my script available [1]. As long as you have the necessary Perl modules installed you should be able to run it. Be forewarned. In its present state it will create about 500 MARC records in your local directory.

When and if you run the script and you have MARC::Record & friends installed, you should be able to run marcdump against them:

  $ marcdump *.mrc

Most records seem just fine, but others make marcdump croak. Thus, the heart of my question lies in the following lines:

  # save it
  open MARC, " > $identifier.mrc" or die "Can't open $identifier.mrc: $!\n";
  binmode MARC, ":utf8";
  print MARC $response->content;
  close MARC;

Are they sufficient for correctly saving the MARC records locally? Should/can I do some sort of check of $response->content before I call binmode and print? Should I use $response->decode_content instead?

[1] script - http://infomotions.com/tmp/harvest.pl

-- 
Eric Lease Morgan
Hesburgh Libraries, University of Notre Dame

(574) 631-8604