[libcatmandu-marc-perl] 19/26: using MARC::Spec 2.0 with indicator values

Jonas Smedegaard dr at jones.dk
Tue Dec 19 12:17:05 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 a0b00d0118439b2eb5bb1f49b0ec02b81db8e445
Author: Carsten Klee <cKlee at users.noreply.github.com>
Date:   Sat Dec 16 08:19:18 2017 +0100

    using MARC::Spec 2.0 with indicator values
---
 lib/Catmandu/MARC.pm | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 2351f9d..3b1757e 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -495,17 +495,6 @@ sub marc_spec {
     @fields = grep { $_->[0] =~ /$tag_spec/ } @{ $record };
     return unless @fields;
 
-    # filter by indicator
-    my ( $indicator1, $indicator2 );
-    if ( $field_spec->has_indicator1 ) {
-        $indicator1 = $field_spec->indicator1;
-        $indicator1 = qr/$indicator1/;
-    }
-   if ( $field_spec->has_indicator2 ) {
-        $indicator2 = $field_spec->indicator2;
-        $indicator2 = qr/$indicator2/;
-   }
-
     # calculate char start
     my $chst = sub {
         my ($sp) = @_;
@@ -580,16 +569,6 @@ sub marc_spec {
             ? ++$tag_index
             : 0; #: $field_spec->index_start;
 
-        # filter by indicator
-        if( defined $indicator1 ) {
-            next unless ( defined $field->[1] && $field->[1] =~ $indicator1);
-        }
-
-        if( defined $indicator2 ) {
-            #next unless $field->[2] =~ $indicator2;
-            next unless ( defined $field->[2] && $field->[2] =~ $indicator2);
-        }
-
         # filter by index
         if ( defined $index_range ) {
             next unless ( Catmandu::Util::array_includes( $index_range, $tag_index ) );
@@ -695,6 +674,11 @@ sub marc_spec {
             } # end of subfield iteration
             $to_referred->(@subfields) if @subfields;
         } # end of subfield handling
+        elsif($ms->has_indicator){
+            my @indicators = ();
+            push @indicators, $field->[$ms->indicator->position];
+            $to_referred->(@indicators);
+        }
         else { # no particular subfields requested
             my @contents = ();
             for ( my $i = 4 ; $i < @{$field} ; $i += 2 ) {

-- 
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