Permalink
Browse files

marc to dublincore

  • Loading branch information...
1 parent aaea50a commit 2803e6a83f1ef8a9c6664e096fc9c404a4b7f868 @nicolasfranck nicolasfranck committed May 16, 2012
Showing with 16 additions and 4 deletions.
  1. +4 −3 fix/marc2dublincore
  2. +12 −1 test/marc2dublin.pl
View
7 fix/marc2dublincore
@@ -127,8 +127,8 @@ marc_map('001','sys');
marc_map('003','prefix');
move_field('prefix','id.$append');
move_field('sys','id.$append');
-#join_field('id',':');
-#move_field('id','identifier.$append');
+join_field('id',':');
+move_field('id','identifier.$append');
marc_map('020a','identifier.$append');
marc_map('022a','identifier.$append');
@@ -210,4 +210,5 @@ marc_map('247','title.$append');
marc_map('Leader06','type.$append');
marc_map('Leader07','type.$append');
marc_map('655','type.$append');
-#remove_field('record');
+remove_field('record');
+remove_field('_id');
View
13 test/marc2dublin.pl
@@ -37,7 +37,18 @@ BEGIN
my $importer = Catmandu::Importer::MARC->new(file => $fh, type => 'XML');
$fixer->fix($importer)->each(sub{
my $ref = shift;
- print Dumper($ref);
+ foreach(keys %$ref){
+ if(is_array_ref($ref->{$_})){
+ delete $ref->{$_} if scalar(@{ $ref->{$_} }) <= 0;
+ }
+ }
+ foreach my $key(sort keys %$ref){
+ if(is_array_ref($ref->{$key})){
+ printf("%20s : %s\n",$key,$_) foreach(@{ $ref->{$key} });
+ }else{
+
+ }
+ }
});
close $fh;
}

0 comments on commit 2803e6a

Please sign in to comment.