[libcatmandu-marc-perl] 95/208: Removing undef values before joining strings
Jonas Smedegaard
dr at jones.dk
Sat Oct 28 03:42:39 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 cd0e3f916fa7b0bc58875a8a8dd3a35d6c38d67f
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date: Tue Feb 28 11:01:49 2017 +0100
Removing undef values before joining strings
---
lib/Catmandu/MARC.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index a164553..3fb997c 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -88,11 +88,15 @@ sub marc_map {
if (@$v) {
if (!$split) {
- $v = join $join_char, @$v;
+ my @defined_values = grep {defined($_)} @$v;
+ $v = join $join_char, @defined_values;
}
if (defined(my $off = $context->{from})) {
- $v = join $join_char, @$v if (ref $v eq 'ARRAY');
+ if (ref $v eq 'ARRAY') {
+ my @defined_values = grep {defined($_)} @$v;
+ $v = join $join_char, @defined_values;
+ }
my $len = $context->{len};
if (length(${v}) > $off) {
$v = substr($v, $off, $len);
--
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