X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=Equinox-Migration%2Flib%2FEquinox%2FMigration%2FMapDrivenMARCXMLProc.pm;h=46f973b072c543af91d9a7e967ff63033eb99fa1;hp=9c698a1dd545c3921ff30bb12f2fccc04c49e452;hb=18fca809c93e51044990d15c8ed800d64bea846a;hpb=ef8cc7d38891b4fab1ce59c2c9df60ed08f9446c diff --git a/Equinox-Migration/lib/Equinox/Migration/MapDrivenMARCXMLProc.pm b/Equinox-Migration/lib/Equinox/Migration/MapDrivenMARCXMLProc.pm index 9c698a1..46f973b 100644 --- a/Equinox-Migration/lib/Equinox/Migration/MapDrivenMARCXMLProc.pm +++ b/Equinox-Migration/lib/Equinox/Migration/MapDrivenMARCXMLProc.pm @@ -23,8 +23,10 @@ our $VERSION = '1.002'; my $dstore; my $sfmap; my @mods = qw( multi bib required ); +my $reccount; my $verbose = 0; + =head1 SYNOPSIS Foo @@ -49,6 +51,8 @@ and C (the MARC data to be processed). sub new { my ($class, %args) = @_; + $verbose = 1 if $args{verbose}; + my $self = bless { }, $class; @@ -60,7 +64,7 @@ sub new { # initialize datastore $dstore = DBM::Deep->new( file => "EMMXSSTORAGE.dbmd", data_sector_size => 256 ); - $dstore->{rcnt} = 0; # next record ptr + $reccount = 0; # next record ptr $dstore->{tags} = $sfmap->tags; # list of all tags $self->{data} = $dstore; @@ -94,11 +98,14 @@ sub parse_record { # cleanup memory and increment pointer $record->purge; - $dstore->{rcnt}++; + $reccount++; # check for required fields check_required(); push @{ $dstore->{recs} }, $crec; + + print STDERR "$reccount\n" + if ($verbose and !($reccount % 1000)); } sub process_field { @@ -164,7 +171,7 @@ sub process_subs { # if this were a multi field, it would be handled already. make sure its a singleton die "Multiple occurances of a non-multi field: $tag$code at rec ", - ($dstore->{rcnt} + 1),"\n" if (defined $dataf->{uni}{$code}); + ($reccount + 1),"\n" if (defined $dataf->{uni}{$code}); # everything seems okay $dataf->{uni}{$code} = $sub->text; @@ -184,7 +191,7 @@ sub check_required { $found = 1 if ($tag->{uni}{$code}); } - die "Required mapping $tag_id$code not found in rec ",$dstore->{rcnt},"\n" + die "Required mapping $tag_id$code not found in rec ",$reccount,"\n" unless ($found); } }