[libcatmandu-marc-perl] 04/208: Fixing Catmandu::Fix::marc_map option value and subfields #33

Jonas Smedegaard dr at jones.dk
Sat Oct 28 03:42:29 UTC 2017


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

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

commit 826cc9d850538b976ffa0e2e734b5cc98783dc7f
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date:   Mon Jun 13 14:19:54 2016 +0200

    Fixing Catmandu::Fix::marc_map option value and subfields #33
---
 lib/Catmandu/Fix/marc_map.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/Catmandu/Fix/marc_map.pm b/lib/Catmandu/Fix/marc_map.pm
index c5c0cdb..e2891ac 100644
--- a/lib/Catmandu/Fix/marc_map.pm
+++ b/lib/Catmandu/Fix/marc_map.pm
@@ -61,8 +61,14 @@ sub emit {
         if ($self->value) {
             $perl .= $fixer->emit_declare_vars($v, $fixer->emit_string($self->value));
             $perl .= $fixer->emit_create_path($fixer->var, $path, sub {
-                my $var = shift;
-                "${var} = ${v};";
+                my $var2 = shift;
+                my $i = $fixer->generate_var;
+                return 
+                "for (my ${i} = 3; ${i} < \@{${var}}; ${i} += 2) {".
+                    "if (${var}->[${i}] =~ /${subfield_regex}/) {".
+                        "${var2} = ${v}; last;".
+                    "}".
+                "}";
             });
         } else {
             my $i = $fixer->generate_var;

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