[libcatmandu-marc-perl] 72/208: Removing new lines in ALEPHSEQ

Jonas Smedegaard dr at jones.dk
Sat Oct 28 03:42:36 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 d431dd6b5757a852f01ecfe509da4e6cda74ef61
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date:   Wed Jan 18 09:23:12 2017 +0100

    Removing new lines in ALEPHSEQ
---
 Build.PL                               |  4 ++--
 Changes                                |  3 ++-
 LICENSE                                |  6 +++---
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm |  1 +
 t/08-exporter.t                        | 10 ++++++----
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/Build.PL b/Build.PL
index b215536..31243e8 100644
--- a/Build.PL
+++ b/Build.PL
@@ -1,5 +1,5 @@
 
-# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.039.
+# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.008.
 use strict;
 use warnings;
 
@@ -18,7 +18,7 @@ my %module_build_args = (
     "Patrick Hochstenbach, C<< <patrick.hochstenbach at ugent.be> >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.03",
+  "dist_version" => "1.04",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index cf19545..a9b59aa 100644
--- a/Changes
+++ b/Changes
@@ -1,7 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
-
+  - Skipping new lines in ALEPHSEQ exports
+  
 1.03  2016-11-03 08:48:19 CET
   - Adding a Catmandu::MARC::Tutorial
   - Fixing a bug in the marc_has_many
diff --git a/LICENSE b/LICENSE
index 039236e..848ef76 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-This software is copyright (c) 2016 by Patrick Hochstenbach.
+This software is copyright (c) 2017 by Patrick Hochstenbach.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@ b) the "Artistic License"
 
 --- The GNU General Public License, Version 1, February 1989 ---
 
-This software is Copyright (c) 2016 by Patrick Hochstenbach.
+This software is Copyright (c) 2017 by Patrick Hochstenbach.
 
 This is free software, licensed under:
 
@@ -272,7 +272,7 @@ That's all there is to it!
 
 --- The Artistic License 1.0 ---
 
-This software is Copyright (c) 2016 by Patrick Hochstenbach.
+This software is Copyright (c) 2017 by Patrick Hochstenbach.
 
 This is free software, licensed under:
 
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index be9288c..8cc109a 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -103,6 +103,7 @@ sub add {
                  my ($code,$val) = splice(@data, 0, 2);
                  next unless $code =~ /[A-Za-z0-9]/o;
                  next unless is_string($val);
+                 $val =~ s{[[:cntrl:]]}{}g;
                  push @line , '$$' , $code , $val;
              }
              push @lines , join('', @line);
diff --git a/t/08-exporter.t b/t/08-exporter.t
index 69daa0e..c672234 100644
--- a/t/08-exporter.t
+++ b/t/08-exporter.t
@@ -5,7 +5,7 @@ use warnings;
 
 use Catmandu::Exporter::MARC;
 use XML::XPath;
-use Test::Simple tests => 24;
+use Test::Simple tests => 25;
 
 my $xml = undef;
 
@@ -90,8 +90,8 @@ ok($xml !~ /000000001 500/, 'test skip empty subfields');
 
 $xml = '';
 $exporter = Catmandu::Exporter::MARC->new(
-                  file => \$xml, 
-                  type=> 'ALEPHSEQ', 
+                  file => \$xml,
+                  type=> 'ALEPHSEQ',
                   record_format => 'MARC-in-JSON',
                   skip_empty_subfields => 1
 );
@@ -108,9 +108,11 @@ $exporter->add({
     { '501' => { 'ind1' => ' ', 'ind2' => ' ' }} ,
     { '502' => { 'subfields' => [ { 'a' => undef} , { 'b' , 'ok' } ] , 'ind1' => ' ', 'ind2' => ' ' } } ,
     { '503' => { 'subfields' => [ { 'a' => '' }] , 'ind1' => ' ', 'ind2' => ' '}} ,
+    { '540' => { 'subfields' => [ { 'a' => "\nabcd\n" }] , 'ind1' => ' ', 'ind2' => ' '}}
   ]
 });
 
 ok($xml =~ /^000000001/, 'test id');
 ok($xml =~ /000000001 100   L \$\$aDavis, Miles\$\$cTest/, 'test subfields');
-ok($xml !~ /000000001 500/, 'test skip empty subfields');
\ No newline at end of file
+ok($xml !~ /000000001 500/, 'test skip empty subfields');
+ok($xml =~ /000000001 540   L \$\$aabcd/, 'test skip newlines');

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