I'm probably missing something obvious, but I have been unsuccessful in
trying to capture the warnings reported by  MARC::Record that are set by
MARC::File::USMARC->decode(). Is there a simple way to store the warnings
reported during the decode() process (using a MARC::Record or MARC::Batch
object)? 

When MARC::Record/Batch call next() on a record with problems reported
during decoding, the warning (for example  warnings about indicators being
forced to blanks, or about entirely empty subfields) prints to the screen
(STDERR?), but I  can't seem to directly capture those warnings to an array
(for later reporting). I have tried using:

#my $batch = MARC::Batch->new('USMARC', "$inputfile");
my @basewarnings = $batch->warnings();
or 
#$record = $batch->next()
my @basewarnings = $record->warnings();

push @haswarnings, @basewarnings;

Both seem to fail to capture the warnings reported by MARC::File::USMARC.

As a workaround, I wrote rawanddecodedscan.pl [1], which works well enough
as a stand-alone program. However, now  I would like to integrate those
warnings into the warnings reported by my lintallchecks.pl (and related
MARC::Lint-based)  programs [2].

In the Raw and Decoded Scan program, I got around the problem by opening the
file of MARC records twice and then  going through each record
simulaneously, decoding one manually and the other using MARC::Record.

Thank you for your assistance,

Bryan Baldus
http://home.inwave.com/eija/
[EMAIL PROTECTED]

##############################

[1] Raw and Decoded Scan script:
http://home.inwave.com/eija/fullrecscripts/rawanddecodedscan.txt

[2] Lint All Checks script:
http://home.inwave.com/eija/fullrecscripts/lintallchecks.txt

Reply via email to