[libcatmandu-marc-perl] 04/26: Deleting double code

Jonas Smedegaard dr at jones.dk
Tue Dec 19 12:17:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag upstream/1.23.1
in repository libcatmandu-marc-perl.

commit 715db8b8575adca36eeeef95a98eda99e9e55a50
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date:   Fri Nov 10 09:42:08 2017 +0100

    Deleting double code
---
 lib/Catmandu/Importer/MARC/ISO.pm | 44 +--------------------------------------
 1 file changed, 1 insertion(+), 43 deletions(-)

diff --git a/lib/Catmandu/Importer/MARC/ISO.pm b/lib/Catmandu/Importer/MARC/ISO.pm
index 4fe266e..28d99d1 100644
--- a/lib/Catmandu/Importer/MARC/ISO.pm
+++ b/lib/Catmandu/Importer/MARC/ISO.pm
@@ -90,50 +90,8 @@ sub generator {
     # MARC::File doesn't provide support for inline files
     $file = $self->decoder->fake_marc_file($self->fh,'MARC::File::USMARC') unless $file;
     sub  {
-      $self->decode_marc($file->next());
+      $self->decoder->decode($file->next(),$self->id);
     }
 }
 
-sub decode_marc {
-    my ($self, $record) = @_;
-    return unless eval { $record->isa('MARC::Record') };
-    my @result = ();
-
-    push @result , [ 'LDR' , undef, undef, '_' , $record->leader ];
-
-    for my $field ($record->fields()) {
-        my $tag  = $field->tag;
-        my $ind1 = $field->indicator(1);
-        my $ind2 = $field->indicator(2);
-
-        my @sf = ();
-
-        if ($field->is_control_field) {
-            push @sf , '_', $field->data;
-        }
-
-        for my $subfield ($field->subfields) {
-            push @sf , @$subfield;
-        }
-
-        push @result, [$tag,$ind1,$ind2, at sf];
-    }
-
-    my $sysid = undef;
-    my $id = $self->id;
-
-    if ($id =~ /^00/ && $record->field($id)) {
-        $sysid = $record->field($id)->data();
-    }
-    elsif ($id =~ /^([0-9]{3})([0-9a-zA-Z])$/) {
-        my $field = $record->field($1);
-        $sysid = $field->subfield($2) if ($field);
-    }
-    elsif (defined $id  && $record->field($id)) {
-        $sysid = $record->field($id)->subfield("a");
-    }
-
-    return { _id => $sysid , record => \@result };
-}
-
 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git



More information about the Pkg-perl-cvs-commits mailing list