Skip to content
This repository has been archived by the owner on Nov 12, 2018. It is now read-only.

Commit

Permalink
marc to dublincore
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasfranck committed May 16, 2012
1 parent aaea50a commit 2803e6a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
7 changes: 4 additions & 3 deletions fix/marc2dublincore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ marc_map('001','sys');
marc_map('003','prefix'); marc_map('003','prefix');
move_field('prefix','id.$append'); move_field('prefix','id.$append');
move_field('sys','id.$append'); move_field('sys','id.$append');
#join_field('id',':'); join_field('id',':');
#move_field('id','identifier.$append'); move_field('id','identifier.$append');


marc_map('020a','identifier.$append'); marc_map('020a','identifier.$append');
marc_map('022a','identifier.$append'); marc_map('022a','identifier.$append');
Expand Down Expand Up @@ -210,4 +210,5 @@ marc_map('247','title.$append');
marc_map('Leader06','type.$append'); marc_map('Leader06','type.$append');
marc_map('Leader07','type.$append'); marc_map('Leader07','type.$append');
marc_map('655','type.$append'); marc_map('655','type.$append');
#remove_field('record'); remove_field('record');
remove_field('_id');
13 changes: 12 additions & 1 deletion test/marc2dublin.pl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,7 +37,18 @@ BEGIN
my $importer = Catmandu::Importer::MARC->new(file => $fh, type => 'XML'); my $importer = Catmandu::Importer::MARC->new(file => $fh, type => 'XML');
$fixer->fix($importer)->each(sub{ $fixer->fix($importer)->each(sub{
my $ref = shift; 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; close $fh;
} }
Expand Down

0 comments on commit 2803e6a

Please sign in to comment.