adding support for a --marctype flag, useful for supplying a MARCXML stream instead...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 23 Mar 2007 22:17:35 +0000 (22:17 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 23 Mar 2007 22:17:35 +0000 (22:17 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7096 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/import/marc2are.pl
Open-ILS/src/extras/import/marc2bre.pl

index 1b627d9..e9abea9 100755 (executable)
@@ -20,18 +20,18 @@ use Unicode::Normalize;
 use Time::HiRes qw/time/;
 use Getopt::Long;
 use MARC::Batch;
-use MARC::File::XML;
+use MARC::File::XML ( BinaryEncoding => 'utf-8' );
 use MARC::Charset;
-use UNIVERSAL::require;
 
 MARC::Charset->ignore_errors(1);
 
-my ($utf8, $id_field, $count, $user, $password, $config, $keyfile,  @files, @trash_fields) =
-       (0, '998', 1, 'admin', 'open-ils', '/openils/conf/bootstrap.conf');
+my ($utf8, $id_field, $count, $user, $password, $config, $marctype, $keyfile,  @files, @trash_fields) =
+       (0, '998', 1, 'admin', 'open-ils', '/openils/conf/bootstrap.conf', 'USMARC');
 
 GetOptions(
        'startid=i'     => \$count,
        'user=s'        => \$user,
+       'marctype=s'    => \$marctype,
        'password=s'    => \$password,
        'config=s'      => \$config,
        'file=s'        => \@files,
@@ -51,7 +51,7 @@ $user = OpenILS::Application::AppUtils->check_user_session( login($user,$passwor
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $batch = new MARC::Batch ( 'USMARC', @files );
+my $batch = new MARC::Batch ( $marctype, @files );
 $batch->strict_off();
 $batch->warnings_off();
 
index 6f9c0fa..203efbf 100755 (executable)
@@ -24,16 +24,16 @@ use FileHandle;
 use Time::HiRes qw/time/;
 use Getopt::Long;
 use MARC::Batch;
-use MARC::File::XML;
-use MARC::Charset qw/utf8_to_marc8/;;
-use UNIVERSAL::require;
+use MARC::File::XML ( BinaryEncoding => 'utf-8' );
+use MARC::Charset;
 
 MARC::Charset->ignore_errors(1);
 
-my ($id_field, $recid, $user, $config, $keyfile, $dontuse_file, $enc, @files, @trash_fields) =
-       ('', 1, 1, '/openils/conf/bootstrap.conf');
+my ($id_field, $recid, $user, $config, $marctype, $keyfile, $dontuse_file, $enc, @files, @trash_fields) =
+       ('', 1, 1, '/openils/conf/bootstrap.conf', 'USMARC');
 
 GetOptions(
+       'marctype=i'    => \$marctype,
        'startid=i'     => \$recid,
        'idfield=s'     => \$id_field,
        'user=s'        => \$user,
@@ -96,7 +96,7 @@ if ($dontuse_file) {
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $batch = new MARC::Batch ( 'USMARC', @files );
+my $batch = new MARC::Batch ( $marctype, @files );
 $batch->strict_off();
 $batch->warnings_off();