bug 1372: count MARC records correctly

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Galen Charlton 2008-02-08 16:55:41 -06:00 committed by Joshua Ferraro
parent b549d7e1f1
commit b88682f1bb
3 changed files with 10 additions and 0 deletions

View File

@ -266,6 +266,9 @@ sub BatchStageMarcRecords {
# FIXME - for now, we're dealing only with bibs
my $rec_num = 0;
foreach my $marc_blob (split(/\x1D/, $marc_records)) {
$marc_blob =~ s/^\s+//g;
$marc_blob =~ s/\s+$//g;
next unless $marc_blob;
$rec_num++;
if ($progress_interval and (0 == ($rec_num % $progress_interval))) {
&$progress_callback($rec_num);

View File

@ -54,6 +54,10 @@ sub process_batch {
$/ = "\035";
my $num_input_records = 0;
while (<IN>) {
s/^\s+//;
s/\s+$//;
next unless $_; # skip if record has only whitespace, as might occur
# if file includes newlines between each MARC record
$marc_records .= $_; # FIXME - this sort of string concatenation
# is probably rather inefficient
$num_input_records++;

View File

@ -75,7 +75,10 @@ if ($completedJobID) {
my $uploaded_file = C4::UploadedFile->fetch($sessionID, $fileID);
my $fh = $uploaded_file->fh();
my $marcrecord='';
$/ = "\035";
while (<$fh>) {
s/^\s+//;
s/\s+$//;
$marcrecord.=$_;
}