Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

marc to dublincore

  • Loading branch information...
commit 2803e6a83f1ef8a9c6664e096fc9c404a4b7f868 1 parent aaea50a
Nicolas Franck authored
7  fix/marc2dublincore
@@ -127,8 +127,8 @@ marc_map('001','sys');
127 127
 marc_map('003','prefix');
128 128
 move_field('prefix','id.$append');
129 129
 move_field('sys','id.$append');
130  
-#join_field('id',':');
131  
-#move_field('id','identifier.$append');
  130
+join_field('id',':');
  131
+move_field('id','identifier.$append');
132 132
 
133 133
 marc_map('020a','identifier.$append');
134 134
 marc_map('022a','identifier.$append');
@@ -210,4 +210,5 @@ marc_map('247','title.$append');
210 210
 marc_map('Leader06','type.$append');
211 211
 marc_map('Leader07','type.$append');
212 212
 marc_map('655','type.$append');
213  
-#remove_field('record');
  213
+remove_field('record');
  214
+remove_field('_id');
13  test/marc2dublin.pl
@@ -37,7 +37,18 @@ BEGIN
37 37
         my $importer = Catmandu::Importer::MARC->new(file => $fh, type => 'XML');
38 38
         $fixer->fix($importer)->each(sub{
39 39
             my $ref = shift;
40  
-            print Dumper($ref);
  40
+            foreach(keys %$ref){
  41
+                if(is_array_ref($ref->{$_})){
  42
+                    delete $ref->{$_} if scalar(@{ $ref->{$_} }) <= 0;
  43
+                }
  44
+            }
  45
+            foreach my $key(sort keys %$ref){
  46
+                if(is_array_ref($ref->{$key})){
  47
+                    printf("%20s : %s\n",$key,$_) foreach(@{ $ref->{$key} });
  48
+                }else{
  49
+
  50
+                }
  51
+            }
41 52
         });
42 53
         close $fh;
43 54
     }

0 notes on commit 2803e6a

Please sign in to comment.
Something went wrong with that request. Please try again.