multi hash now uses just code for key
authorShawn Boyette <sboyette@esilibrary.com>
Wed, 27 May 2009 15:35:12 +0000 (15:35 +0000)
committerShawn Boyette <sboyette@esilibrary.com>
Wed, 27 May 2009 15:35:12 +0000 (15:35 +0000)
Equinox-Migration/Changes
Equinox-Migration/lib/Equinox/Migration/MapDrivenMARCXMLProc.pm
Equinox-Migration/t/03-MapDrivenMARCXMLProc.t

index e29d599..327c1d7 100644 (file)
@@ -1,5 +1,10 @@
 Revision history for Equinox-Migration
 
+2009-05-27  MDMP 1.001
+
+  * The multi hash no longer uses tag+code for keys. Just code
+    (e.g. '999a' is now just 'a')
+
 2009-05-07  MDMP 1.000 & MS 1.000
 
 2009-04-30  SM 1.004
index 2b90a03..75424ff 100644 (file)
@@ -13,11 +13,11 @@ Equinox::Migration::MapDrivenMARCXMLProc
 
 =head1 VERSION
 
-Version 1.000
+Version 1.001
 
 =cut
 
-our $VERSION = '1.000';
+our $VERSION = '1.001';
 
 
 =head1 SYNOPSIS
@@ -169,8 +169,7 @@ sub process_subs {
     # handle multi modifier
     if (my $mods = $map->mods($field)) {
         if ($mods->{multi}) {
-            my $name = $tag . $code;
-            push @{$dataf->{multi}{$name}}, $sub->text;
+            push @{$dataf->{multi}{$code}}, $sub->text;
             return;
         }
     }
@@ -261,7 +260,7 @@ Then C<$rec> will look like:
       tags => [
                 {
                   tag   => tag_id,
-                  multi => { (tag_id . sub_code) => [ val1, val2, ... ] },
+                  multi => { code => [ val1, val2, ... ] },
                   uni   => { code => value, code2 => value2, ... },
                 },
                 ...
@@ -282,9 +281,8 @@ Each tag hash holds its own id (e.g. C<998>), and two references to
 two more hashrefs, C<multi> and C<uni>.
 
 The C<multi> hash holds the extracted data for tag/sub mappings which
-have the C<multiple> modifier on them. The keys in C<multi> are
-composed of the tag id and subfield code, catenated
-(e.g. C<901c>). The values are arrayrefs containing the content of all
+have the C<multiple> modifier on them. The keys in C<multi> subfield
+codes.  The values are arrayrefs containing the content of all
 instances of that subfield in that instance of that tag. If no tags
 are defined as C<multi>, it will be C<undef>.
 
index 6e19df4..ddd8c85 100644 (file)
@@ -88,7 +88,7 @@ is ($rec->{tags}[0]{tag}, 250, 'should be 250');
 is ($rec->{tags}[0]{uni}{a}, "1st ed.", '999$a');
 is ($rec->{tags}[1]{tag}, 999, 'should be 999');
 is ($rec->{tags}[1]{uni}{a}, "MYS DEM", '999$a');
-is_deeply ($rec->{tags}[1]{multi}{'999x'}, ['MYSTERY'], '999$x - multi');
+is_deeply ($rec->{tags}[1]{multi}{'x'}, ['MYSTERY'], '999$x - multi');
 is_deeply ($rec->{tmap}{250}, [0], 'tag map test 1a');
 is_deeply ($rec->{tmap}{999}, [1], 'tag map test 1b');
 $rec = $mp->parse_record;
@@ -96,7 +96,7 @@ $rec = $mp->parse_record;
 $rec = $mp->parse_record;
 is ($rec->{tags}[0]{tag}, 999, '250 doesnt exist in this record');
 is ($rec->{tags}[0]{uni}{a}, "FIC DEV", 'subfield value 4');
-is_deeply ($rec->{tags}[0]{multi}{'999x'}, ['FICTION','FICTION2','FICTION3','FICTION4'],
+is_deeply ($rec->{tags}[0]{multi}{'x'}, ['FICTION','FICTION2','FICTION3','FICTION4'],
            '999$x - multi');
 is ($rec->{tmap}{250}, undef, 'tag map test 2a');
 is_deeply ($rec->{tmap}{999}, [0], 'tag map test 2b');
@@ -109,4 +109,4 @@ $rec = $mp->parse_record;
 $rec = $mp->parse_record;
 $rec = $mp->parse_record;
 $rec = $mp->parse_record;
-is_deeply ($rec->{tags}[0]{multi}{'999x'}, ['FICTION'], '999$x - multi no digits');
+is_deeply ($rec->{tags}[0]{multi}{'x'}, ['FICTION'], '999$x - multi no digits');