[open-ils-commits] r10480 -
trunk/Open-ILS/src/perlmods/OpenILS/Application
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Aug 29 15:39:57 EDT 2008
Author: erickson
Date: 2008-08-29 15:39:54 -0400 (Fri, 29 Aug 2008)
New Revision: 10480
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
Log:
MARC::File does not like IO::Scalar, using open() instead. defaulting to caller as the queue owner.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm 2008-08-29 17:02:22 UTC (rev 10479)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm 2008-08-29 19:39:54 UTC (rev 10480)
@@ -21,8 +21,8 @@
use Time::HiRes qw(time);
-use OpenSRF::Utils::Logger qw/:level/;
-my $log = 'OpenSRF::Utils::Logger';
+use OpenSRF::Utils::Logger qw/$logger/;
+use MIME::Base64;
sub initialize {}
sub child_init {}
@@ -57,6 +57,7 @@
return $e->die_event unless $e->checkauth;
return $e->die_event unless $e->allowed('CREATE_BIB_IMPORT_QUEUE', $owner);
+ $owner ||= $e->requestor->id;
my $queue = new Fieldmapper::vandelay::bib_queue();
$queue->name( $name );
@@ -89,6 +90,7 @@
return $e->die_event unless $e->checkauth;
return $e->die_event unless $e->allowed('CREATE_AUTHORITY_IMPORT_QUEUE', $owner);
+ $owner ||= $e->requestor->id;
my $queue = new Fieldmapper::vandelay::authority_queue();
$queue->name( $name );
@@ -228,13 +230,18 @@
my $purpose = $data->{purpose};
$data = decode_base64($data->{marc});
- my $fh = new IO::Scalar \$data;
+ $logger->info("vandelay loaded $fingerprint purpose=$purpose and ".length($data)." bytes of data");
- my $batch = new MARC::Batch ( $type, $fh );
+ my $fh;
+ open $fh, '<', \$data;
+
+ my $marctype = 'USMARC'; # ?
+ my $batch = new MARC::Batch ( $marctype, $fh );
$batch->strict_off;
my $count = 0;
while (my $r = $batch->next) {
+ $logger->info("processing record $count");
try {
(my $xml = $r->as_xml_record()) =~ s/\n//sog;
$xml =~ s/^<\?xml.+\?\s*>//go;
@@ -253,7 +260,7 @@
$client->respond( $count );
} catch Error with {
my $error = shift;
- $log->warn("Encountered a bad record at Vandelay ingest: ".$error);
+ $logger->warn("Encountered a bad record at Vandelay ingest: ".$error);
}
}
More information about the open-ils-commits
mailing list