tweaks
authorShawn Boyette <sboyette@esilibrary.com>
Wed, 24 Jun 2009 19:20:19 +0000 (19:20 +0000)
committerShawn Boyette <sboyette@esilibrary.com>
Wed, 24 Jun 2009 19:20:19 +0000 (19:20 +0000)
Equinox-Migration/lib/Equinox/Migration/MapDrivenMARCXMLProc.pm
extract_holdings

index 2e4a455..194a593 100644 (file)
@@ -66,7 +66,8 @@ sub new {
     die "Datastore file 'EMMXSSTORAGE.dbmd' already exists. Exiting.\n"
       if (-e "EMMXSSTORAGE.dbmd");
     $dstore = DBM::Deep->new( file => "EMMXSSTORAGE.dbmd",
-                              data_sector_size => 256,
+                              max_buckets => 64,
+                              #data_sector_size => 256,
                               autoflush => 0,
                             );
     $reccount = 0;            # next record ptr
index 78fbde5..fadcf8d 100755 (executable)
@@ -49,10 +49,13 @@ sub extract_holdings {
     while (  $m->{data}{recs}[$i] ) {
         print HOLDINGS "BEGIN;\n\negid\thseq\t" unless $j;
         my $rec = $m->{data}{recs}[$i];
+        my $k = 0; # holding-within-record pointer
 
         # for each holdings tag in the record...
-        for my $holdidx ( @{$rec->{tmap}{ $c->{holdings} }} ) {
+        while ( $rec->{tmap}{ $c->{holdings} }[$k] ) {
+            my $holdidx = $rec->{tmap}{ $c->{holdings} }[$k];
             my $tagid = $rec->{tags}[$holdidx]{tag};
+            $k++;
 
             my @out = ();            # clear the output buffer
             push @out, $rec->{egid}; # slug in the egid first thing
@@ -79,8 +82,7 @@ sub extract_holdings {
                 my $idx = $rec->{tmap}{$othertag}[0]; # get index into tags struct
                 for my $sub ( sort keys %{$rec->{tags}[$idx]{uni}} ) {
                     push @out, $rec->{tags}[$idx]{uni}{$sub};
-                    print "l_", $m->name($rec->{tags}[$idx]{tag}, $sub), "\t"
-                      unless $j;
+                    print "l_", $m->name($rec->{tags}[$idx]{tag}, $sub), "\t" unless $j;
                 }
             }
 
@@ -89,6 +91,8 @@ sub extract_holdings {
             print HOLDINGS join("\t", @out);
             print HOLDINGS "\n";
             $j++;
+
+            @out = undef;
         }
         $i++;
         print "\r$i";