[libcatmandu-marc-perl] 183/208: Fixing 0 as undef bug

Jonas Smedegaard dr at jones.dk
Sat Oct 28 03:42:48 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 04d58b9ab4b5e4c61fc561c53f90b6800f2ce14e
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date:   Wed Jul 12 09:32:51 2017 +0200

    Fixing 0 as undef bug
---
 Build.PL                     | 2 +-
 Changes                      | 1 +
 lib/Catmandu/Fix/marc_map.pm | 4 ++--
 t/03-marc_map.t              | 2 ++
 t/test.fix                   | 2 ++
 5 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Build.PL b/Build.PL
index 0b2b478..a929a05 100644
--- a/Build.PL
+++ b/Build.PL
@@ -1,5 +1,5 @@
 
-# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.005.
+# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.008.
 use strict;
 use warnings;
 
diff --git a/Changes b/Changes
index d2dba4f..2d4d03c 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+  - Fixing 0 as false bug when using from/until
 
 1.161  2017-07-06 14:36:29 CEST
   - Fixing marc_replace_all evaluating search groups
diff --git a/lib/Catmandu/Fix/marc_map.pm b/lib/Catmandu/Fix/marc_map.pm
index eb1dc3e..2854be0 100644
--- a/lib/Catmandu/Fix/marc_map.pm
+++ b/lib/Catmandu/Fix/marc_map.pm
@@ -43,10 +43,10 @@ sub emit {
     my $perl = "";
     $perl .= $fixer->emit_declare_vars($current_value, "[]");
     $perl .=<<EOF;
-if (my ${result} = ${marc}->marc_map(
+if (defined(my ${result} = ${marc}->marc_map(
             ${var},
             ${marc_path},
-            ${marc_opt}) ) {
+            ${marc_opt})) ) {
     ${result} = ref(${result}) ? ${result} : [${result}];
     for ${current_value} (\@{${result}}) {
 EOF
diff --git a/t/03-marc_map.t b/t/03-marc_map.t
index 190f355..85c2bcc 100644
--- a/t/03-marc_map.t
+++ b/t/03-marc_map.t
@@ -51,6 +51,8 @@ is $records->[0]->{has_500_not_c}, 'OK' , '^c value subfield';
 
 ok ! $records->[0]->{has_500_not_a}, '^a value subfield';
 
+is $records->[0]->{has_800_0} , '0' , '800/0';
+
 # gh#46: Test for subfield codes 0
 {
     my $mrc
diff --git a/t/test.fix b/t/test.fix
index adb320c..388df46 100644
--- a/t/test.fix
+++ b/t/test.fix
@@ -32,4 +32,6 @@ marc_map('260h','has_260h', value:'BAD')
 marc_map('500^c','has_500_not_c', value: 'OK')
 marc_map('500^a','has_500_not_a', value: 'BAD')
 
+marc_map('008/0','has_800_0')
+
 marc_xml('record')

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