[libcatmandu-marc-perl] 103/208: Fixing marc_spec example
Jonas Smedegaard
dr at jones.dk
Sat Oct 28 03:42:40 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 4000a410c24a1ea6221d49c008ac4de817f35754
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date: Thu Mar 2 13:13:17 2017 +0100
Fixing marc_spec example
---
lib/Catmandu/MARC.pm | 9 +++++++--
t/21-marc-spec.t | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 21f02e6..3441e6c 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -536,6 +536,7 @@ sub marc_spec {
}
}
else { # no particular subfields requested
+
my $char_start = $field_spec->char_start;
if ( defined $char_start ) {
$char_start =
@@ -543,6 +544,7 @@ sub marc_spec {
? $field_spec->char_length * -1
: $char_start;
}
+
my @mapped = ();
for my $field (@fields) {
my $start = 4;
@@ -561,13 +563,16 @@ sub marc_spec {
}
push @mapped, @subfields;
}
- unless (@mapped) { return $vals }
+
+ unless (@mapped) {
+ return $vals
+ }
if ($split) {
$vals = [[@mapped]];
}
elsif ($append) {
- $vals = [@mapped];
+ $vals = [ @mapped ];
}
elsif (@mapped) {
$vals = join $join_char, @mapped;
diff --git a/t/21-marc-spec.t b/t/21-marc-spec.t
index 1fa3319..f8fd65b 100644
--- a/t/21-marc-spec.t
+++ b/t/21-marc-spec.t
@@ -52,7 +52,7 @@ is_deeply
is_deeply
$records->[9]->{my}{fields}{indicators10},
- ['Cross-platform Perl /Eric F. Johnson.'],
+ ['Cross-platform Perl /','Eric F. Johnson.'],
q|fix: marc_spec('..._10', my.fields.indicators10.$append);|;
is scalar @{$records->[9]->{my}{fields}{indicators_0}}, 9, q|fix: marc_spec('...__0', my.fields.indicators_0, split: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