[libcatmandu-marc-perl] 178/208: Version up

2017-10-27 Thread Jonas Smedegaard
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 3de4467e0c4d04dcce96cd201180598b8b69
Author: Patrick Hochstenbach 
Date:   Tue Jul 4 15:27:43 2017 +0200

Version up
---
 Build.PL | 2 +-
 Changes  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Build.PL b/Build.PL
index 3a766ad..e702fc8 100644
--- a/Build.PL
+++ b/Build.PL
@@ -18,7 +18,7 @@ my %module_build_args = (
 "Patrick Hochstenbach, C<<  >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.15",
+  "dist_version" => "1.16",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index 8ae947f..0130002 100644
--- a/Changes
+++ b/Changes
@@ -1,12 +1,13 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+  - Adding marc_copy (Carsten Klee) and marc_paste fix
 
 1.15  2017-06-29 16:31:39 CEST
   - Adding the marc_spec_has Fix Condition (Carsten Klee)
   - Adding marc_replace_all fix
   - Adding marc_append fix
-  
+
 1.14  2017-06-23 07:48:49 CEST
   - Upgrading to Catmandu 1.06X
   - Using the Catmandu::Fix::Bind::Group style for marc_each bind

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 189/208: Merge branch 'cKlee-dev' into dev

2017-10-27 Thread Jonas Smedegaard
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 c60f06da95e2b7c3fb809a19d3eccb62054ab1fb
Merge: 2004832 b3da71d
Author: Patrick Hochstenbach 
Date:   Thu Jul 13 08:48:56 2017 +0200

Merge branch 'cKlee-dev' into dev

 lib/Catmandu/Fix/marc_spec.pm | 4 ++--
 t/21-marc-spec.t  | 2 ++
 t/marc_spec.fix   | 2 ++
 3 files changed, 6 insertions(+), 2 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 193/208: Adding skip_errors option

2017-10-27 Thread Jonas Smedegaard
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 35a72031d2faee20d084a20169378200fb3a
Author: Patrick Hochstenbach 
Date:   Fri Jul 21 10:44:38 2017 +0200

Adding skip_errors option
---
 Build.PL  |   2 +-
 Changes   |   4 +-
 lib/Catmandu/Exporter/MARC.pm |  73 +++---
 lib/Catmandu/Importer/MARC.pm | 106 
 t/01-importer.t   |  12 +-
 t/broken.xml  | 551 ++
 6 files changed, 674 insertions(+), 74 deletions(-)

diff --git a/Build.PL b/Build.PL
index 4119588..df4fe1a 100644
--- a/Build.PL
+++ b/Build.PL
@@ -1,5 +1,5 @@
 
-# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild 
v6.008.
+# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild 
v6.005.
 use strict;
 use warnings;
 
diff --git a/Changes b/Changes
index dc310cd..a05b5a7 100644
--- a/Changes
+++ b/Changes
@@ -1,10 +1,12 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+  - Adding skip_errors option in the importer and exporter
+  - More POD
 
 1.171  2017-07-13 08:50:35 CEST
   - Fixing 0 as false bug in marc_spec
-  
+
 1.17  2017-07-12 11:45:56 CEST
   - Fixing 0 as false bug when using from/until
   - Fixing double fix execution bug
diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index 6543656..35a54b6 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -6,6 +6,7 @@ use Moo;
 our $VERSION = '1.171';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
+has skip_errors=> (is => 'ro');
 has _exporter  => (is => 'ro');
 
 with 'Catmandu::Exporter';
@@ -31,7 +32,20 @@ sub BUILD {
 }
 
 sub add {
-$_[0]->_exporter->add($_[1]);
+  my ($self) = @_;
+
+  if ($self->skip_errors) {
+eval {
+  $self->_exporter->add($_[1]);
+};
+
+if ($@) {
+  $self->log->error("error at record " . $self->count . " : $@");
+}
+  }
+  else {
+$self->_exporter->add($_[1]);
+  }
 }
 
 sub commit {
@@ -48,17 +62,14 @@ Catmandu::Exporter::MARC - Exporter for MARC records
 
 =head1 SYNOPSIS
 
-# From the command line
-$ catmandu convert MARC --type ISO to MARC --type XML < /foo/bar.mrc
-
-# From Perl
-use Catmandu;
+  # Convert MARC to MARC
+  $ catmandu convert MARC to MARC < /foo/bar.mrc > /foo/output.mrc
 
-my $importer = Catmandu->importer('MARC', file => "/foo/bar.mrc" , type => 
'ISO');
-my $exporter = Catmandu->exporter('MARC', file => "marc.xml", type => 
"XML" );
+  # Add fixes
+  $ catmandu convert MARC to MARC --fix myfixes.txt < /foo/bar.mrc > 
/foo/output.mrc
 
-$exporter->add($importer);
-$exporter->commit;
+  # Convert on format to another format
+  $ catmandu convert MARC --type ISO to MARC --type ALEPHSEQ < /foo/bar.mrc > 
/foo/bar.aleph
 
 =head1 DESCRIPTION
 
@@ -67,38 +78,46 @@ to a file or the standard output.
 
 =head1 CONFIGURATION
 
-In addition to the configuration provided by L (C,
-C, etc.) the exporter can be configured with the following parameters:
+=over
 
-The 'type' parameter describes the MARC syntax variant. Supported values 
include:
+=item file
 
-=over
+Write output to a local file given by its path or file handle.  Alternatively a
+scalar reference can be passed to write to a string and a code reference can be
+used to write to a callback function.
 
-=item
+=item fh
 
-ISO: L (default)
+Write the output to an L. If not specified,
+L is used to create the output
+handle from the C argument or by using STDOUT.
 
-=item
+=item fix
 
-XML: L
+An ARRAY of one or more fixes or file scripts to be applied to exported items.
 
-=item
+=item type
 
-MARCMaker: L
+The MARC format to parse. The following MARC parsers are available:
 
-=item
+  ISO: L (default) - a strict ISO 2709 exporter
+  ALEPHSEQ: L - an exporter for Ex Libris 
Aleph sequential files
+  MARCMaker: L - an exporter for 
MARCMaker/MARCBreaker records
+  MiJ: L (MARC in JSON) - an export for the 
MARC-in-JSON format
+  XML: L - an exporter for the MARC XML format
 
-MiJ: L (MARC in JSON)
+=item skip_errors
 
-=item
+If set, then any errors when parsing MARC output will be skipped and ignored. 
Use the
+debug setting of catmandu to view all error messages:
 
-ALEPHSEQ: L
+  $ catmandu -D convert MARC to MARC --skip_errors 1 --fix myfixes.txt < 
/foo/bar.mrc
 
-=back
+=item 
 
-E.g.
+Every MARC importer can have its own options. Check the documentation of the 
specific importer.
 
-catmandu convert MARC --type XML to MARC --type ISO < marc.xml > marc.iso
+=back
 
 =head1 SEE ALSO
 
diff --git a/lib/Catmandu/Importer/MARC.pm b/lib/Catmandu/Importer/MARC.pm
index 7a600ad..1024185 100644
--- a/lib/Catmandu/Importer/MARC.pm
+++ b/lib/Catmandu/Importer/MARC.pm
@@ -6,6 +6,7 @@ use Moo;
 our 

[libcatmandu-marc-perl] 205/208: Fixing the commit return value

2017-10-27 Thread Jonas Smedegaard
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 1aa7a9e70e18c31172aa3a5295df88bd9f3fc876
Author: Patrick Hochstenbach 
Date:   Wed Sep 27 18:30:18 2017 +0200

Fixing the commit return value
---
 lib/Catmandu/Exporter/MARC/MARCMaker.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/Catmandu/Exporter/MARC/MARCMaker.pm 
b/lib/Catmandu/Exporter/MARC/MARCMaker.pm
index 8c9f1b9..728e371 100644
--- a/lib/Catmandu/Exporter/MARC/MARCMaker.pm
+++ b/lib/Catmandu/Exporter/MARC/MARCMaker.pm
@@ -82,6 +82,8 @@ sub add {
 sub commit {
my ($self) = @_;
$self->fh->flush;
+
+1;
 }
 
 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 200/208: Fixing pod

2017-10-27 Thread Jonas Smedegaard
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 890ac0fe4a00536df8fc6888c55fc85bd75608d8
Author: Patrick Hochstenbach 
Date:   Wed Sep 27 12:26:34 2017 +0200

Fixing pod
---
 lib/Catmandu/Fix/Condition/marc_all_match.pm | 2 +-
 lib/Catmandu/Fix/Condition/marc_any_match.pm | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/Catmandu/Fix/Condition/marc_all_match.pm 
b/lib/Catmandu/Fix/Condition/marc_all_match.pm
index 514bd0a..bd85277 100644
--- a/lib/Catmandu/Fix/Condition/marc_all_match.pm
+++ b/lib/Catmandu/Fix/Condition/marc_all_match.pm
@@ -74,7 +74,7 @@ Evaluates to true when the MARC_PATH values matches the 
REGEX, false otherwise.
 
 =head1 SEE ALSO
 
-L
+L
 
 =cut
 
diff --git a/lib/Catmandu/Fix/Condition/marc_any_match.pm 
b/lib/Catmandu/Fix/Condition/marc_any_match.pm
index 2165928..ba93ec1 100644
--- a/lib/Catmandu/Fix/Condition/marc_any_match.pm
+++ b/lib/Catmandu/Fix/Condition/marc_any_match.pm
@@ -74,7 +74,7 @@ Evaluates to true when the MARC_PATH values matches the 
REGEX, false otherwise.
 
 =head1 SEE ALSO
 
-L
+L
 
 =cut
 
diff --git a/lib/Catmandu/Fix/Condition/marc_match.pm 
b/lib/Catmandu/Fix/Condition/marc_match.pm
index cead25d..32b9154 100644
--- a/lib/Catmandu/Fix/Condition/marc_match.pm
+++ b/lib/Catmandu/Fix/Condition/marc_match.pm
@@ -62,7 +62,8 @@ Evaluates to true when the MARC_PATH values matches the 
REGEX, false otherwise.
 
 =head1 SEE ALSO
 
-L
+L,
+L, 
 
 =cut
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 194/208: Adding more POD

2017-10-27 Thread Jonas Smedegaard
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 b237bca1aaadf38701c4c36c4dec3286fb0a1cc9
Author: Patrick Hochstenbach 
Date:   Sat Jul 22 11:40:26 2017 +0200

Adding more POD
---
 lib/Catmandu/Fix/marc_copy.pm  |  30 +++
 lib/Catmandu/Fix/marc_cut.pm   |  30 +++
 lib/Catmandu/MARC/Tutorial.pod | 174 +++--
 3 files changed, 229 insertions(+), 5 deletions(-)

diff --git a/lib/Catmandu/Fix/marc_copy.pm b/lib/Catmandu/Fix/marc_copy.pm
index 9efe1a1..2e53bc7 100644
--- a/lib/Catmandu/Fix/marc_copy.pm
+++ b/lib/Catmandu/Fix/marc_copy.pm
@@ -143,6 +143,36 @@ need to be copied:
 # Copy all the 300 fields which have subfield c equal to 'ABC'
 marc_copy(300c,tmp,equal:"^ABC")
 
+=head1 JSON PATHS
+
+Catmandu Fixes can be used to edit the data in the copied fields. To have easy 
access
+to the data in the copied fields, these JSON paths can be used (where VAR is 
the
+name of field into which you copied the data)
+
+VAR.*.tag   - The names of all MARC tags
+VAR.*.ind1  - All first indicators
+VAR.*.ind2  - All second indicators
+VAR.*.subfields.*.a - The value of all $a subfields
+VAR.*.subfields.$first.a - The value of the first $a subfield
+VAR.*.subfields.$last.a - The value of the last $a subfield
+VAR.*.content   - The value of the first control field
+
+VAR.$first.subfields.$first.z - The value of the second $z subfield in the 
first MARC field
+
+These JSON paths can be used like:
+
+# Set the first indicator of all 300 fields
+do marc_each()
+  if marc_has(300)
+marc_copy(300,tmp)
+
+# Set the first indicator to 1
+set_field(tmp.*.ind1,1)
+
+marc_paste(tmp)
+  end
+end
+
 =head1 INLINE
 
 This Fix can be used inline in a Perl script:
diff --git a/lib/Catmandu/Fix/marc_cut.pm b/lib/Catmandu/Fix/marc_cut.pm
index fa33345..19b98b0 100644
--- a/lib/Catmandu/Fix/marc_cut.pm
+++ b/lib/Catmandu/Fix/marc_cut.pm
@@ -101,6 +101,36 @@ need to be copied:
 # Cut all the 300 fields which have subfield c equal to 'ABC'
 marc_cut(300c,tmp,equal:"^ABC")
 
+=head1 JSON PATHS
+
+Catmandu Fixes can be used to edit the data in the cut fields. To have easy 
access
+to the data in the copied fields, these JSON paths can be used (where VAR is 
the
+name of field into which you copied the data)
+
+VAR.*.tag   - The names of all MARC tags
+VAR.*.ind1  - All first indicators
+VAR.*.ind2  - All second indicators
+VAR.*.subfields.*.a - The value of all $a subfields
+VAR.*.subfields.$first.a - The value of the first $a subfield
+VAR.*.subfields.$last.a - The value of the last $a subfield
+VAR.*.content   - The value of the first control field
+
+VAR.$first.subfields.$first.z - The value of the second $z subfield in the 
first MARC field
+
+These JSON paths can be used like:
+
+# Set the first indicator of all 300 fields
+do marc_each()
+  if marc_has(300)
+marc_cut(300,tmp)
+
+# Set the first indicator to 1
+set_field(tmp.*.ind1,1)
+
+marc_paste(tmp)
+  end
+end
+
 =head1 INLINE
 
 This Fix can be used inline in a Perl script:
diff --git a/lib/Catmandu/MARC/Tutorial.pod b/lib/Catmandu/MARC/Tutorial.pod
index 8e8ffdc..0e97114 100644
--- a/lib/Catmandu/MARC/Tutorial.pod
+++ b/lib/Catmandu/MARC/Tutorial.pod
@@ -232,6 +232,174 @@ output
 
 $ catmandu -D convert MARC to Null --fix myfix.fix < data.mrc
 
+=head1 TRANSFORMING
+
+=head2 Add a new MARC field
+
+In the example bellow we add new 856 field to the record with a $u subfield 
containing
+the Google homepage:
+
+   marc_add(856,u,"http://www.google.com;)
+
+A control field can be added by using the '_' subfield
+
+   marc_add(009,_,0123456789)
+
+Maybe you want to copy the data from one subfield to another. Use the marc_map 
to
+store the data first in a temporary field and add it later to the new field:
+
+   # copy a subfield
+   marc_map(001,tmp)
+
+   # maybe process the data a bit
+   append(tmp,"-mytest")
+
+   # add the contents of the tmp field to the new 009 field
+   marc_add(009,_,$.tmp)
+
+=head2 Set a MARC subfield
+
+Set the $h subfield to a new value (or create it when it doesn't exist yet):
+
+   marc_set(100h, test123)
+
+Only set the 100 field if the first indicator is 3
+
+   marc_set(100[3]h, test123)
+
+=head2 Remove a MARC (sub)field
+
+Remove all fields 500 , 501 , 5** :
+
+   marc_remove(5**)
+
+Remove all 245h fields:
+
+   marc_remove(245h)
+
+=head2 Append text to a MARC field
+
+Append a period to the 500 field is there isn't already there:
+
+  do marc_each()
+unless marc_match(500, "\.$")# Only if the current field 500 doesn't 
end with a period
+  marc_append(500,".")   # Add to the current 500 field a period
+end
+  end
+
+Use the L 

[libcatmandu-marc-perl] 191/208: 1.171

2017-10-27 Thread Jonas Smedegaard
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 b09b30a2095fe40e615d76758a1892b1c450a699
Author: Patrick Hochstenbach 
Date:   Thu Jul 13 08:51:08 2017 +0200

1.171
---
 Build.PL | 2 +-
 Changes  | 2 ++
 lib/Catmandu/Exporter/MARC.pm| 2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/Base.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm| 2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Exporter/MARC/XML.pm| 2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   | 2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  | 2 +-
 lib/Catmandu/Fix/marc_add.pm | 2 +-
 lib/Catmandu/Fix/marc_append.pm  | 2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm | 2 +-
 lib/Catmandu/Fix/marc_in_json.pm | 2 +-
 lib/Catmandu/Fix/marc_map.pm | 2 +-
 lib/Catmandu/Fix/marc_paste.pm   | 2 +-
 lib/Catmandu/Fix/marc_remove.pm  | 2 +-
 lib/Catmandu/Fix/marc_replace_all.pm | 2 +-
 lib/Catmandu/Fix/marc_set.pm | 2 +-
 lib/Catmandu/Fix/marc_spec.pm| 2 +-
 lib/Catmandu/Fix/marc_xml.pm | 2 +-
 lib/Catmandu/Importer/MARC.pm| 2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm| 2 +-
 lib/Catmandu/Importer/MARC/ISO.pm| 2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   | 2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   | 2 +-
 lib/Catmandu/Importer/MARC/RAW.pm| 2 +-
 lib/Catmandu/Importer/MARC/Record.pm | 2 +-
 lib/Catmandu/Importer/MARC/XML.pm| 2 +-
 lib/Catmandu/MARC.pm | 2 +-
 40 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/Build.PL b/Build.PL
index 7f67e62..4119588 100644
--- a/Build.PL
+++ b/Build.PL
@@ -18,7 +18,7 @@ my %module_build_args = (
 "Patrick Hochstenbach, C<<  >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.17",
+  "dist_version" => "1.171",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index 7bba93f..dc310cd 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+
+1.171  2017-07-13 08:50:35 CEST
   - Fixing 0 as false bug in marc_spec
   
 1.17  2017-07-12 11:45:56 CEST
diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index 42ab1c2..6543656 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -3,7 +3,7 @@ use Catmandu::Sane;
 use Catmandu::Util;
 use Moo;
 
-our $VERSION = '1.17';
+our $VERSION = '1.171';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
 has _exporter  => (is => 'ro');
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index 92f6661..15351bc 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -58,7 +58,7 @@ use Catmandu::Util qw(xml_escape is_different :array :is);
 use List::Util;
 use Moo;
 
-our $VERSION = '1.17';
+our $VERSION = '1.171';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/Base.pm 
b/lib/Catmandu/Exporter/MARC/Base.pm
index 8c02c0a..3678996 100644
--- a/lib/Catmandu/Exporter/MARC/Base.pm
+++ b/lib/Catmandu/Exporter/MARC/Base.pm
@@ -3,7 +3,7 @@ use Moo::Role;
 use MARC::Record;
 use MARC::Field;
 
-our $VERSION = '1.17';
+our $VERSION = '1.171';
 
 sub _raw_to_marc_record {
 my ($self,$data) = @_;
diff --git a/lib/Catmandu/Exporter/MARC/ISO.pm 
b/lib/Catmandu/Exporter/MARC/ISO.pm
index 4f5693d..01f7dc1 100644
--- a/lib/Catmandu/Exporter/MARC/ISO.pm
+++ b/lib/Catmandu/Exporter/MARC/ISO.pm
@@ -60,7 +60,7 @@ use MARC::Record;
 use MARC::Field;
 use MARC::File::USMARC;
 
-our $VERSION = '1.17';
+our $VERSION = '1.171';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/MARCMaker.pm 
b/lib/Catmandu/Exporter/MARC/MARCMaker.pm
index 

[libcatmandu-marc-perl] 201/208: Creating tests Perl module

2017-10-27 Thread Jonas Smedegaard
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 0de1750607d7d33e32f02afb9ca84ec0bf1974f9
Author: Patrick Hochstenbach 
Date:   Wed Sep 27 15:01:03 2017 +0200

Creating tests Perl module
---
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm |   1 +
 lib/Catmandu/Exporter/MARC/XML.pm  |   3 +-
 t/00-load.t|  21 
 t/01-importer.t|  55 -
 t/04-marc21.t  |  20 
 t/13-marcxml.t |  56 -
 t/28-marc_append.t |  23 
 t/Catmandu/Exporter/MARC.t |  17 +++
 t/Catmandu/Exporter/MARC/ALEPHSEQ.t|  74 
 t/Catmandu/Exporter/MARC/Base.t|  17 +++
 t/Catmandu/Exporter/MARC/ISO.t |  17 +++
 t/Catmandu/Exporter/MARC/MARCMaker.t   |  17 +++
 t/Catmandu/Exporter/MARC/MiJ.t |  17 +++
 t/{08-exporter.t => Catmandu/Exporter/MARC/XML.t}  | 129 +++--
 .../Fix/Bind/marc_each.t}  |  12 +-
 t/Catmandu/Fix/Condition/marc_all_match.t  |  17 +++
 t/Catmandu/Fix/Condition/marc_any_match.t  |  17 +++
 .../Fix/Condition/marc_has.t}  |  16 ++-
 t/Catmandu/Fix/Condition/marc_has_many.t   |  17 +++
 t/Catmandu/Fix/Condition/marc_match.t  |  17 +++
 .../Fix/Condition/marc_spec_has.t} |  17 ++-
 t/Catmandu/Fix/Inline/marc_add.t   |  17 +++
 t/Catmandu/Fix/Inline/marc_map.t   |  17 +++
 t/Catmandu/Fix/Inline/marc_remove.t|  17 +++
 t/Catmandu/Fix/Inline/marc_set.t   |  17 +++
 t/{09-marc_add.t => Catmandu/Fix/marc_add.t}   |  20 ++--
 t/Catmandu/Fix/marc_append.t   |  25 
 t/{26-marc_copy.t => Catmandu/Fix/marc_copy.t} |  13 ++-
 t/{30-marc_cut.t => Catmandu/Fix/marc_cut.t}   |  12 +-
 .../Fix/marc_decode_dollar_subfields.t}|  19 ++-
 .../Fix/marc_in_json.t}|  27 +++--
 t/{03-marc_map.t => Catmandu/Fix/marc_map.t}   |  17 ++-
 t/{29-marc_paste.t => Catmandu/Fix/marc_paste.t}   |  15 ++-
 t/{05-marc_remove.t => Catmandu/Fix/marc_remove.t} |  19 ++-
 .../Fix/marc_replace_all.t}|  16 ++-
 t/{12-marc_set.t => Catmandu/Fix/marc_set.t}   |  20 ++--
 t/{21-marc-spec.t => Catmandu/Fix/marc_spec.t} |  22 +++-
 t/Catmandu/Fix/marc_xml.t  |  17 +++
 t/Catmandu/Importer/MARC.t |  17 +++
 .../Importer/MARC/ALEPHSEQ.t}  |  19 ++-
 t/Catmandu/Importer/MARC/Decoder.t |  17 +++
 t/{19-io-string.t => Catmandu/Importer/MARC/ISO.t} |  47 +++-
 t/Catmandu/Importer/MARC/Lint.t|  17 +++
 .../Importer/MARC/MARCMaker.t} |  20 +++-
 t/{11-mij.t => Catmandu/Importer/MARC/MiJ.t}   |  20 +++-
 .../Importer/MARC/MicroLIF.t}  |  19 ++-
 t/Catmandu/Importer/MARC/RAW.t |  32 +
 t/Catmandu/Importer/MARC/Record.t  |  39 +++
 t/Catmandu/Importer/MARC/XML.t |  44 +++
 t/Catmandu/MARC.t  |  17 +++
 t/{99-deprecate.t => deprecate.t}  |   0
 t/{07-inline-fix.t => inline-fix.t}|   0
 t/{18-inlineable.t => inlineable.t}|   0
 t/{22-mapping_rules.t => mapping_rules.t}  |   0
 ...3-mapping_rules_spec.t => mapping_rules_spec.t} |   0
 ...4-marc-spec-subspecs.t => marc-spec-subspecs.t} |   0
 ...internal-syntax.t => old-new-internal-syntax.t} |   0
 57 files changed, 863 insertions(+), 335 deletions(-)

diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index dca0253..fb91280 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -133,6 +133,7 @@ sub add {
 sub commit {
my $self = shift;
$self->fh->flush;
+1;
 }
 
 1;
diff --git a/lib/Catmandu/Exporter/MARC/XML.pm 
b/lib/Catmandu/Exporter/MARC/XML.pm
index dc70c22..57a272b 100644
--- a/lib/Catmandu/Exporter/MARC/XML.pm
+++ b/lib/Catmandu/Exporter/MARC/XML.pm
@@ -97,6 +97,8 @@ sub commit {
 }
 
 $self->fh->flush;
+
+1;
 }
 
 1;
@@ -180,4 +182,3 @@ L, and L for a full 
list of methods.
 L
 
 =cut
-
diff --git a/t/00-load.t b/t/00-load.t
deleted file mode 100644
index e2388b3..000
--- a/t/00-load.t
+++ /dev/null
@@ -1,21 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-use Test::More;
-
-BEGIN {
-use_ok 'Catmandu::Importer::MARC';
-use_ok 'Catmandu::Exporter::MARC';
-use_ok 'Catmandu::Fix::marc_map';
-use_ok 'Catmandu::Fix::marc_xml';
-  

[libcatmandu-marc-perl] 204/208: Adding more tests

2017-10-27 Thread Jonas Smedegaard
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 2b6773401d598cbfb405f7d94072a006884c261f
Author: Patrick Hochstenbach 
Date:   Wed Sep 27 18:28:59 2017 +0200

Adding more tests
---
 lib/Catmandu/Exporter/MARC/MiJ.pm|  2 +
 lib/Catmandu/Fix/marc_xml.pm | 25 ++-
 lib/Catmandu/Importer/MARC/Lint.pm   |  3 ++
 t/Catmandu/Exporter/MARC/ALEPHSEQ.t  | 22 -
 t/Catmandu/Exporter/MARC/MiJ.t   | 28 
 t/Catmandu/Fix/Condition/marc_has_many.t | 77 
 t/Catmandu/Fix/marc_xml.t| 68 
 t/Catmandu/Importer/MARC/Lint.t  | 19 
 8 files changed, 231 insertions(+), 13 deletions(-)

diff --git a/lib/Catmandu/Exporter/MARC/MiJ.pm 
b/lib/Catmandu/Exporter/MARC/MiJ.pm
index 5fa8e30..cde3927 100644
--- a/lib/Catmandu/Exporter/MARC/MiJ.pm
+++ b/lib/Catmandu/Exporter/MARC/MiJ.pm
@@ -137,6 +137,8 @@ sub add {
 sub commit {
my ($self) = @_;
$self->fh->flush;
+
+1;
 }
 
 1;
diff --git a/lib/Catmandu/Fix/marc_xml.pm b/lib/Catmandu/Fix/marc_xml.pm
index 89692be..0b85045 100644
--- a/lib/Catmandu/Fix/marc_xml.pm
+++ b/lib/Catmandu/Fix/marc_xml.pm
@@ -4,6 +4,7 @@ use Catmandu::Sane;
 use Moo;
 use Catmandu::MARC;
 use Catmandu::Fix::Has;
+use Clone qw(clone);
 
 with 'Catmandu::Fix::Inlineable';
 
@@ -14,8 +15,28 @@ has path  => (fix_arg => 1);
 # Transform a raw MARC array into MARCXML
 sub fix {
 my ($self, $data) = @_;
-my $xml = Catmandu::MARC->instance->marc_xml($data);
-$data->{$self->path} = $xml;
+my $path = $self->{path};
+
+return $data unless exists $data->{$path};
+
+if ($path eq 'record') {
+my $xml = Catmandu::MARC->instance->marc_xml($data);
+$data->{$path} = $xml;
+}
+elsif (exists $data->{record}) {
+my $copy   = clone($data->{record});
+$data->{record}= $data->{$path};
+my $xml = Catmandu::MARC->instance->marc_xml($data);
+$data->{$path} = $xml;
+$data->{record}= $copy;
+}
+else {
+$data->{record}= $data->{$path};
+my $xml = Catmandu::MARC->instance->marc_xml($data);
+$data->{$path} = $xml;
+delete $data->{record};
+}
+
 $data;
 }
 
diff --git a/lib/Catmandu/Importer/MARC/Lint.pm 
b/lib/Catmandu/Importer/MARC/Lint.pm
index 01518ef..8fa17ab 100644
--- a/lib/Catmandu/Importer/MARC/Lint.pm
+++ b/lib/Catmandu/Importer/MARC/Lint.pm
@@ -99,6 +99,9 @@ sub generator {
 $file = $self->decoder->fake_marc_file($self->fh,'MARC::File::USMARC') 
unless $file;
 sub  {
my $marc = $file->next();
+
+   return undef unless $marc;
+   
my $doc  = $self->decoder->decode($marc,$self->id);
$lint->check_record( $marc );
$doc->{lint} = [$lint->warnings];
diff --git a/t/Catmandu/Exporter/MARC/ALEPHSEQ.t 
b/t/Catmandu/Exporter/MARC/ALEPHSEQ.t
index 4f849b9..2d9ad59 100644
--- a/t/Catmandu/Exporter/MARC/ALEPHSEQ.t
+++ b/t/Catmandu/Exporter/MARC/ALEPHSEQ.t
@@ -15,9 +15,9 @@ BEGIN {
 
 require_ok $pkg;
 
-my $xml = undef;
+my $alephseq = undef;
 
-my $exporter = Catmandu::Exporter::MARC->new(file => \$xml, type=> 'ALEPHSEQ' 
, skip_empty_subfields => 1);
+my $exporter = Catmandu::Exporter::MARC->new(file => \$alephseq, type=> 
'ALEPHSEQ' , skip_empty_subfields => 1);
 
 ok $exporter , 'got an MARC/ALEPHSEQ exporter';
 
@@ -38,13 +38,13 @@ ok $exporter->add({
 
 ok $exporter->commit;
 
-ok($xml =~ /^1/, 'test id');
-ok($xml =~ /1 100   L \$\$aDavis, Miles\$\$cTest/, 'test subfields');
-ok($xml !~ /1 500/, 'test skip empty subfields');
+ok($alephseq =~ /^1/, 'test id');
+ok($alephseq =~ /1 100   L \$\$aDavis, Miles\$\$cTest/, 'test 
subfields');
+ok($alephseq !~ /1 500/, 'test skip empty subfields');
 
-$xml = '';
+$alephseq = '';
 $exporter = Catmandu::Exporter::MARC->new(
-  file => \$xml,
+  file => \$alephseq,
   type=> 'ALEPHSEQ',
   record_format => 'MARC-in-JSON',
   skip_empty_subfields => 1
@@ -66,9 +66,9 @@ $exporter->add({
   ]
 });
 
-ok($xml =~ /^1/, 'test id');
-ok($xml =~ /1 100   L \$\$aDavis, Miles\$\$cTest/, 'test subfields');
-ok($xml !~ /1 500/, 'test skip empty subfields');
-ok($xml =~ /1 540   L \$\$aabcd/, 'test skip newlines');
+ok($alephseq =~ /^1/, 'test id');
+ok($alephseq =~ /1 100   L \$\$aDavis, Miles\$\$cTest/, 'test 
subfields');
+ok($alephseq !~ /1 500/, 'test skip empty subfields');
+ok($alephseq =~ /1 540   L \$\$aabcd/, 'test skip newlines');
 
 done_testing;
diff --git a/t/Catmandu/Exporter/MARC/MiJ.t b/t/Catmandu/Exporter/MARC/MiJ.t
index edadf7b..5056355 100644
--- a/t/Catmandu/Exporter/MARC/MiJ.t
+++ 

[libcatmandu-marc-perl] 170/208: 1.15

2017-10-27 Thread Jonas Smedegaard
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 d864ce1f91ddca574340d64663e8e123808b6720
Author: Patrick Hochstenbach 
Date:   Thu Jun 29 16:32:18 2017 +0200

1.15
---
 Build.PL | 2 +-
 Changes  | 2 ++
 lib/Catmandu/Exporter/MARC.pm| 2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/Base.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm| 2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Exporter/MARC/XML.pm| 2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   | 2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  | 2 +-
 lib/Catmandu/Fix/marc_add.pm | 2 +-
 lib/Catmandu/Fix/marc_append.pm  | 2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm | 2 +-
 lib/Catmandu/Fix/marc_in_json.pm | 2 +-
 lib/Catmandu/Fix/marc_map.pm | 2 +-
 lib/Catmandu/Fix/marc_remove.pm  | 2 +-
 lib/Catmandu/Fix/marc_replace_all.pm | 2 +-
 lib/Catmandu/Fix/marc_set.pm | 2 +-
 lib/Catmandu/Fix/marc_spec.pm| 2 +-
 lib/Catmandu/Fix/marc_xml.pm | 2 +-
 lib/Catmandu/Importer/MARC.pm| 2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm| 2 +-
 lib/Catmandu/Importer/MARC/ISO.pm| 2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   | 2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   | 2 +-
 lib/Catmandu/Importer/MARC/RAW.pm| 2 +-
 lib/Catmandu/Importer/MARC/Record.pm | 2 +-
 lib/Catmandu/Importer/MARC/XML.pm| 2 +-
 lib/Catmandu/MARC.pm | 2 +-
 39 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/Build.PL b/Build.PL
index b2071dc..02b6076 100644
--- a/Build.PL
+++ b/Build.PL
@@ -18,7 +18,7 @@ my %module_build_args = (
 "Patrick Hochstenbach, C<<  >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.14",
+  "dist_version" => "1.15",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index 7044e93..8ae947f 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+
+1.15  2017-06-29 16:31:39 CEST
   - Adding the marc_spec_has Fix Condition (Carsten Klee)
   - Adding marc_replace_all fix
   - Adding marc_append fix
diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index 24e6512..eb8400f 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -2,7 +2,7 @@ package Catmandu::Exporter::MARC;
 use Catmandu::Sane;
 use Moo;
 
-our $VERSION = '1.14';
+our $VERSION = '1.15';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
 has _exporter  => (is => 'ro' , lazy => 1 , builder => '_build_exporter' , 
handles => 'Catmandu::Exporter');
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index 10a8ff8..ba7eb84 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -58,7 +58,7 @@ use Catmandu::Util qw(xml_escape is_different :array :is);
 use List::Util;
 use Moo;
 
-our $VERSION = '1.14';
+our $VERSION = '1.15';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/Base.pm 
b/lib/Catmandu/Exporter/MARC/Base.pm
index 37ad046..4c640a8 100644
--- a/lib/Catmandu/Exporter/MARC/Base.pm
+++ b/lib/Catmandu/Exporter/MARC/Base.pm
@@ -3,7 +3,7 @@ use Moo::Role;
 use MARC::Record;
 use MARC::Field;
 
-our $VERSION = '1.14';
+our $VERSION = '1.15';
 
 sub _raw_to_marc_record {
 my ($self,$data) = @_;
diff --git a/lib/Catmandu/Exporter/MARC/ISO.pm 
b/lib/Catmandu/Exporter/MARC/ISO.pm
index 4991c87..3bfd2ff 100644
--- a/lib/Catmandu/Exporter/MARC/ISO.pm
+++ b/lib/Catmandu/Exporter/MARC/ISO.pm
@@ -60,7 +60,7 @@ use MARC::Record;
 use MARC::Field;
 use MARC::File::USMARC;
 
-our $VERSION = '1.14';
+our $VERSION = '1.15';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git 

[libcatmandu-marc-perl] 175/208: Renaming marc_struc to marc_copy

2017-10-27 Thread Jonas Smedegaard
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 57a2f027d960e7e91b41c9830ba06611465c2867
Author: Patrick Hochstenbach 
Date:   Tue Jul 4 11:23:48 2017 +0200

Renaming marc_struc to marc_copy
---
 lib/Catmandu/Fix/{marc_struc.pm => marc_copy.pm} | 58 +++-
 lib/Catmandu/MARC.pm |  6 ++-
 t/{26-marc_struc.t => 26-marc_copy.t}| 38 
 3 files changed, 39 insertions(+), 63 deletions(-)

diff --git a/lib/Catmandu/Fix/marc_struc.pm b/lib/Catmandu/Fix/marc_copy.pm
similarity index 74%
rename from lib/Catmandu/Fix/marc_struc.pm
rename to lib/Catmandu/Fix/marc_copy.pm
index 9333cf3..a5b5ac9 100644
--- a/lib/Catmandu/Fix/marc_struc.pm
+++ b/lib/Catmandu/Fix/marc_copy.pm
@@ -1,4 +1,4 @@
-package Catmandu::Fix::marc_struc;
+package Catmandu::Fix::marc_copy;
 
 use Catmandu::Sane;
 use Catmandu::MARC;
@@ -30,7 +30,7 @@ sub emit {
 my $perl = "";
 $perl .= $fixer->emit_declare_vars($current_value, "[]");
 $perl .=<marc_struc(
+if (my ${result} = ${marc}->marc_copy(
 ${var},
 ${marc_path}) ) {
 ${result} = ref(${result}) ? ${result} : [${result}];
@@ -59,14 +59,14 @@ __END__
 
 =head1 NAME
 
-Catmandu::Fix::marc_struc - copy marc data in a structured way to a new field
+Catmandu::Fix::marc_copy - copy marc data in a structured way to a new field
 
 =head1 SYNOPSIS
 
 # fixed field
-marc_struc(001, fixed001)
+marc_copy(001, fixed001)
 
-may result into
+May result into
 
 fixed001 : [
 {
@@ -77,12 +77,12 @@ may result into
 }
 ]
 
-And
+And
 
 # variable field
-marc_struc(650, subjects)
+marc_copy(650, subjects)
 
-may result into
+May result into
 
 subjects:[
 {
@@ -112,30 +112,30 @@ may result into
 
 Copy MARC data referred by MARC_TAG in a structured way to JSON path.
 
-In contrast to L and L 
-marc_struc will not only copy data content (values) but also all data elements 
-like tag, indicators and subfield codes into a nested data structure. 
+In contrast to L and L
+marc_copy will not only copy data content (values) but also all data elements
+like tag, indicators and subfield codes into a nested data structure.
 
 =head1 METHODS
 
-=head2 marc_struc(MARC_TAG, JSON_PATH)
+=head2 marc_copy(MARC_TAG, JSON_PATH)
 
 Copy this data referred by a MARC_TAG to a JSON_PATH.
 
 MARC_TAG (meaning the field tag) is the first segment of MARC_PATH.
 
-Using a MARC_PATH with subfield codes, indicators or substring will cause a 
+Using a MARC_PATH with subfield codes, indicators or substring will cause a
 warning and these segments will be ignored when referring the data.
 
 =head1 INLINE
 
 This Fix can be used inline in a Perl script:
 
-use Catmandu::Fix::marc_struc as => 'marc_struc';
+use Catmandu::Fix::marc_copy as => 'marc_copy';
 
 my $data = { record => ['650', ' ', 0, 'a', 'Perl'] };
 
-$data = marc_struc($data,'650','subject');
+$data = marc_copy($data,'650','subject');
 
 print $data->{subject}->[0]->{tag} , "\n"; # '650'
 print $data->{subject}->[0]->{ind1} , "\n"; # ' '
@@ -146,33 +146,7 @@ This Fix can be used inline in a Perl script:
 
 =over
 
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
-
-=item * L
+=item * L
 
 =back
 
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index f064a9f..e1f0541 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -1037,7 +1037,7 @@ sub compile_marc_path {
 };
 }
 
-sub marc_struc {
+sub marc_copy {
 my $self  = $_[0];
 
 # $_[2] : marc_path
@@ -1229,7 +1229,9 @@ Catmandu::MARC - Catmandu modules for working with MARC 
data
 
 =item * L
 
-=item * L
+=item * L
+
+=item * L
 
 =item * L
 
diff --git a/t/26-marc_struc.t b/t/26-marc_copy.t
similarity index 85%
rename from t/26-marc_struc.t
rename to t/26-marc_copy.t
index 29ce7a3..7d2c93a 100644
--- a/t/26-marc_struc.t
+++ b/t/26-marc_copy.t
@@ -25,13 +25,13 @@ my $mrc = <<'MRC';
 
 MRC
 
-note 'marc_struc(001,cntrl)';
+note 'marc_copy(001,cntrl)';
 {
 my $importer = Catmandu->importer(
 'MARC',
 file => \$mrc,
 type => 'XML',
-fix  => 'marc_struc(001,cntrl); retain_field(cntrl)'
+fix  => 'marc_copy(001,cntrl); retain_field(cntrl)'
 );
 my $record = $importer->first;
 is_deeply $record->{cntrl},
@@ -42,16 +42,16 @@ note 'marc_struc(001,cntrl)';
 ind2 => undef,
 content => "   92005291 "
 }
-], 'marc_struc(001,cntrl)';
+], 'marc_copy(001,cntrl)';
 }
 
-note 'marc_struc(245,title)';
+note 'marc_copy(245,title)';
 {
 my $importer = Catmandu->importer(
 'MARC',

[libcatmandu-marc-perl] 207/208: 1.19

2017-10-27 Thread Jonas Smedegaard
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 80b5c335b15e146e83149b56edcdf2b1276416f5
Author: Patrick Hochstenbach 
Date:   Mon Oct 2 11:16:52 2017 +0200

1.19
---
 Build.PL | 2 +-
 Changes  | 2 ++
 lib/Catmandu/Exporter/MARC.pm| 2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/Base.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm| 2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Exporter/MARC/XML.pm| 2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_all_match.pm | 2 +-
 lib/Catmandu/Fix/Condition/marc_any_match.pm | 2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   | 2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  | 2 +-
 lib/Catmandu/Fix/marc_add.pm | 2 +-
 lib/Catmandu/Fix/marc_append.pm  | 2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm | 2 +-
 lib/Catmandu/Fix/marc_in_json.pm | 2 +-
 lib/Catmandu/Fix/marc_map.pm | 2 +-
 lib/Catmandu/Fix/marc_paste.pm   | 2 +-
 lib/Catmandu/Fix/marc_remove.pm  | 2 +-
 lib/Catmandu/Fix/marc_replace_all.pm | 2 +-
 lib/Catmandu/Fix/marc_set.pm | 2 +-
 lib/Catmandu/Fix/marc_spec.pm| 2 +-
 lib/Catmandu/Fix/marc_xml.pm | 2 +-
 lib/Catmandu/Importer/MARC.pm| 2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm| 2 +-
 lib/Catmandu/Importer/MARC/ISO.pm| 2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   | 2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   | 2 +-
 lib/Catmandu/Importer/MARC/RAW.pm| 2 +-
 lib/Catmandu/Importer/MARC/Record.pm | 2 +-
 lib/Catmandu/Importer/MARC/XML.pm| 2 +-
 lib/Catmandu/MARC.pm | 2 +-
 42 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/Build.PL b/Build.PL
index dd4aa2a..2b51d7b 100644
--- a/Build.PL
+++ b/Build.PL
@@ -18,7 +18,7 @@ my %module_build_args = (
 "Patrick Hochstenbach, C<<  >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.18",
+  "dist_version" => "1.19",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index ae294f7..3635dd6 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+
+1.19  2017-10-02 11:16:17 CEST
   - Adding marc_all_match
   - Adding marc_any_match
   - Deprecating marc_match (in favor of marc_all_match)
diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index acd473f..6d44011 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -3,7 +3,7 @@ use Catmandu::Sane;
 use Catmandu::Util;
 use Moo;
 
-our $VERSION = '1.18';
+our $VERSION = '1.19';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
 has skip_errors=> (is => 'ro');
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index fb91280..a1c7568 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -62,7 +62,7 @@ use Catmandu::Util qw(xml_escape is_different :array :is);
 use List::Util;
 use Moo;
 
-our $VERSION = '1.18';
+our $VERSION = '1.19';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/Base.pm 
b/lib/Catmandu/Exporter/MARC/Base.pm
index 7c4fbe7..287b2f1 100644
--- a/lib/Catmandu/Exporter/MARC/Base.pm
+++ b/lib/Catmandu/Exporter/MARC/Base.pm
@@ -3,7 +3,7 @@ use Moo::Role;
 use MARC::Record;
 use MARC::Field;
 
-our $VERSION = '1.18';
+our $VERSION = '1.19';
 
 sub _raw_to_marc_record {
 my ($self,$data) = @_;
diff --git a/lib/Catmandu/Exporter/MARC/ISO.pm 
b/lib/Catmandu/Exporter/MARC/ISO.pm
index c63c840..e891fb8 100644
--- a/lib/Catmandu/Exporter/MARC/ISO.pm
+++ b/lib/Catmandu/Exporter/MARC/ISO.pm
@@ -60,7 +60,7 @@ use MARC::Record;
 use MARC::Field;
 use MARC::File::USMARC;
 
-our $VERSION = '1.18';
+our $VERSION = '1.19';
 
 with 'Catmandu::Exporter', 

[libcatmandu-marc-perl] 166/208: Updating POD

2017-10-27 Thread Jonas Smedegaard
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 5946b4bd3446a8a73222ed734bd45a26f8943d81
Author: Patrick Hochstenbach 
Date:   Thu Jun 29 15:51:30 2017 +0200

Updating POD
---
 Changes  | 1 +
 lib/Catmandu/MARC.pm | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/Changes b/Changes
index 7e4b009..01ea645 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,7 @@ Revision history for Catmandu-MARC
 
 {{$NEXT}}
   - Adding the marc_spec_has Fix Condition (Carsten Klee)
+  - Adding marc_replace_all fix
   
 1.14  2017-06-23 07:48:49 CEST
   - Upgrading to Catmandu 1.06X
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 02437c7..b18863c 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -1042,6 +1042,8 @@ Catmandu::MARC - Catmandu modules for working with MARC 
data
 
 =item * L
 
+=item * L
+
 =item * L
 
 =item * L

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 180/208: Fixing marc_replace_all allowing marc_replace_all(field, (search), $1)

2017-10-27 Thread Jonas Smedegaard
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 7d05569c9eee2221d57c673d6d6814e545b8984f
Author: Patrick Hochstenbach 
Date:   Thu Jul 6 14:35:28 2017 +0200

Fixing marc_replace_all allowing marc_replace_all(field,(search),$1)
---
 Changes  |  1 +
 lib/Catmandu/Fix/marc_replace_all.pm |  3 +++
 lib/Catmandu/MARC.pm |  3 ++-
 t/26_marc_replace_all.t  | 14 ++
 4 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/Changes b/Changes
index 49d9674..3d149d7 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+  - Fixing marc_replace_all evaluating search groups
 
 1.16  2017-07-04 15:27:51 CEST
   - Adding marc_copy (Carsten Klee) and marc_paste fix
diff --git a/lib/Catmandu/Fix/marc_replace_all.pm 
b/lib/Catmandu/Fix/marc_replace_all.pm
index cd776e7..15126ff 100644
--- a/lib/Catmandu/Fix/marc_replace_all.pm
+++ b/lib/Catmandu/Fix/marc_replace_all.pm
@@ -36,6 +36,9 @@ Catmandu::Fix::marc_replace_all - regex replace (sub)field 
values in a MARC file
 # Replace all 'Joe'-s in 100a to the value in field x.y.z
 marc_replace_all('100a','\bJoe\b',$.x.y.z)
 
+# Replace all the content of 100a with everything in curly brackets
+marc_replace_all('100a','^(.*)$','{$1}')
+
 =head1 DESCRIPTION
 
 Use regex search and replace on MARC field values.
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index ea0b044..f6bba94 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -318,7 +318,8 @@ sub marc_replace_all {
 
 for (my $i = 0; $i < @subfields; $i += 2) {
 if ($subfields[$i] =~ $context->{subfield}) {
-$field->[$i + 4] =~ s{$regex}{$value}g;
+# Trick to double eval the right hand side
+$field->[$i + 4] =~ s{$regex}{"\"$value\""}eeg;
 }
 }
 }
diff --git a/t/26_marc_replace_all.t b/t/26_marc_replace_all.t
index 8e2483d..b12d076 100644
--- a/t/26_marc_replace_all.t
+++ b/t/26_marc_replace_all.t
@@ -32,4 +32,18 @@ use Catmandu::Fix;
 ], q|fix: marc_replace_all('630a','Active','Silly')|;
 }
 
+
+#---
+{
+   my $fixer = Catmandu::Fix->new(fixes => 
[q|marc_replace_all('630','(Active)','{$1}')|,q|marc_map('630a','test.$append')|]);
+   my $importer = Catmandu::Importer::MARC->new( file => 't/camel.mrc', 
type => "ISO" );
+   my $record = $fixer->fix($importer->first);
+
+   is_deeply $record->{test}, [
+'{Active} server pages.' ,
+'{Active}X.'
+], q|fix: marc_replace_all('630a','Active','{Active}')|;
+}
+
+
 done_testing;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 154/208: Version up

2017-10-27 Thread Jonas Smedegaard
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 84e27f08e3c03e3edfc86cce22704b3cdba1c31c
Author: Patrick Hochstenbach 
Date:   Fri Jun 23 07:48:34 2017 +0200

Version up
---
 Build.PL | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Build.PL b/Build.PL
index 0da7e6f..ace1928 100644
--- a/Build.PL
+++ b/Build.PL
@@ -1,5 +1,5 @@
 
-# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild 
v6.008.
+# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild 
v6.005.
 use strict;
 use warnings;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 185/208: Fixing marc_set("FMT", ...) does not work correctly #79

2017-10-27 Thread Jonas Smedegaard
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 48f0f99b66914f44ec4171dbf09508c11f74a942
Author: Patrick Hochstenbach 
Date:   Wed Jul 12 11:23:03 2017 +0200

Fixing marc_set("FMT", ...) does not work correctly #79
---
 Changes |  1 +
 README.md   |  1 +
 lib/Catmandu/Exporter/MARC.pm   | 37 +++--
 lib/Catmandu/Fix/marc_add.pm| 10 --
 lib/Catmandu/Fix/marc_copy.pm   |  2 ++
 lib/Catmandu/Fix/marc_paste.pm  |  4 +++-
 lib/Catmandu/Fix/marc_remove.pm |  6 +-
 lib/Catmandu/Fix/marc_set.pm|  8 +++-
 lib/Catmandu/Importer/MARC.pm   |  5 ++---
 lib/Catmandu/MARC.pm|  6 --
 10 files changed, 56 insertions(+), 24 deletions(-)

diff --git a/Changes b/Changes
index 9e19097..3c8ae4f 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,7 @@ Revision history for Catmandu-MARC
 {{$NEXT}}
   - Fixing 0 as false bug when using from/until
   - Fixing double fix execution bug
+  - Using better subfield defaults for marc_set
 
 1.161  2017-07-06 14:36:29 CEST
   - Fixing marc_replace_all evaluating search groups
diff --git a/README.md b/README.md
index 22afeb9..47d065c 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,7 @@ Catmandu::MARC - Catmandu modules for working with MARC data
 - 
[Catmandu::Fix::marc\_decode\_dollar\_subfields](https://metacpan.org/pod/Catmandu::Fix::marc_decode_dollar_subfields)
 - [Catmandu::Fix::marc\_set](https://metacpan.org/pod/Catmandu::Fix::marc_set)
 - 
[Catmandu::Fix::marc\_copy](https://metacpan.org/pod/Catmandu::Fix::marc_copy)
+- [Catmandu::Fix::marc\_cut](https://metacpan.org/pod/Catmandu::Fix::marc_cut)
 - 
[Catmandu::Fix::marc\_paste](https://metacpan.org/pod/Catmandu::Fix::marc_paste)
 - 
[Catmandu::Fix::Bind::marc\_each](https://metacpan.org/pod/Catmandu::Fix::Bind::marc_each)
 - 
[Catmandu::Fix::Condition::marc\_match](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_match)
diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index 83946de..f653520 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -1,36 +1,45 @@
 package Catmandu::Exporter::MARC;
 use Catmandu::Sane;
+use Catmandu::Util;
 use Moo;
 
 our $VERSION = '1.161';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
-has _exporter  => (is => 'ro' , lazy => 1 , builder => '_build_exporter' , 
handles => 'Catmandu::Exporter');
-has _exporter_args => (is => 'rwp', writer => '_set_exporter_args');
+has _exporter  => (is => 'ro');
 
-sub _build_exporter {
-my ($self) = @_;
-
-my $type = $self->type;
-
-my $pkg = 
Catmandu::Util::require_package($type,'Catmandu::Exporter::MARC');
-
-$pkg->new($self->_exporter_args);
-}
+with 'Catmandu::Exporter';
 
 sub BUILD {
 my ($self,$args) = @_;
-$self->_set_exporter_args($args);
+
+my $type = $self->type;
 
 # keep USMARC temporary as alias for ISO, remove in future version
 # print deprecation warning
-if ($self->{type} eq 'USMARC') {
-$self->{type} = 'ISO';
+if ($type eq 'USMARC') {
+$type = 'ISO';
 warn( "deprecated", "Oops! Exporter \"USMARC\" is deprecated. Use 
\"ISO\" instead." );
 }
+
+my $pkg = 
Catmandu::Util::require_package($type,'Catmandu::Exporter::MARC');
+
+delete $args->{file};
+delete $args->{fix};
+
+$self->{_exporter} = $pkg->new(file => $self->file, %$args);
+}
+
+sub add {
+$_[0]->_exporter->add($_[1]);
+}
+
+sub commit {
+$_[0]->_exporter->commit;
 }
 
 1;
+
 __END__
 
 =head1 NAME
diff --git a/lib/Catmandu/Fix/marc_add.pm b/lib/Catmandu/Fix/marc_add.pm
index c0d5d27..7cb9670 100644
--- a/lib/Catmandu/Fix/marc_add.pm
+++ b/lib/Catmandu/Fix/marc_add.pm
@@ -29,7 +29,10 @@ Catmandu::Fix::marc_add - add new fields to marc
 # Set literal values
 marc_add('900', a, 'test' , 'b', test)
 marc_add('900', ind1 , ' ' , a, 'test' , 'b', test)
-marc_add('900', ind1 , ' ' , a, 'test' , 'b', test , record:record2)
+marc_add('900', ind1 , ' ' , a, 'test' , 'b', test)
+
+# Set control fields
+marc_add('009','_','23123131')
 
 # Copy data from an other field (when the field value is an array, the
 # subfield will be repeated)
@@ -61,7 +64,10 @@ This Fix can be used inline in a Perl script:
 
 =head1 SEE ALSO
 
-L
+L,
+L,
+L,
+L
 
 =cut
 
diff --git a/lib/Catmandu/Fix/marc_copy.pm b/lib/Catmandu/Fix/marc_copy.pm
index c2f2277..9efe1a1 100644
--- a/lib/Catmandu/Fix/marc_copy.pm
+++ b/lib/Catmandu/Fix/marc_copy.pm
@@ -162,6 +162,8 @@ This Fix can be used inline in a Perl script:
 
 =over
 
+=item * L
+
 =item * L
 
 =back
diff --git a/lib/Catmandu/Fix/marc_paste.pm b/lib/Catmandu/Fix/marc_paste.pm
index 9c7c9e5..a19a7c6 100644
--- a/lib/Catmandu/Fix/marc_paste.pm
+++ b/lib/Catmandu/Fix/marc_paste.pm
@@ -90,7 +90,9 @@ 

[libcatmandu-marc-perl] 158/208: updated POD with marc_has_ref

2017-10-27 Thread Jonas Smedegaard
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 35998ab556d988cd19e314f8ed3615bdd8fdc1e8
Author: Carsten Klee 
Date:   Thu Jun 29 11:23:49 2017 +0200

updated POD with marc_has_ref
---
 lib/Catmandu/MARC.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 07d0d49..1859756 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -1003,6 +1003,8 @@ Catmandu::MARC - Catmandu modules for working with MARC 
data
 
 =item * L
 
+=item * L
+
 =item * L
 
 =item * L

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 161/208: Renaming marc_has_ref to marc_spec_has

2017-10-27 Thread Jonas Smedegaard
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 990fe1ca4046af1d74dc21263f6c1407e6f2f3f3
Author: Patrick Hochstenbach 
Date:   Thu Jun 29 14:37:17 2017 +0200

Renaming marc_has_ref to marc_spec_has
---
 Build.PL|  2 +-
 lib/Catmandu/Fix/Condition/marc_has_ref.pm  | 12 ++--
 t/{25-marc_has_ref.t => 25-marc_spec_has.t} |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Build.PL b/Build.PL
index 202e476..b2071dc 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/lib/Catmandu/Fix/Condition/marc_has_ref.pm 
b/lib/Catmandu/Fix/Condition/marc_has_ref.pm
index 1053b43..5369857 100644
--- a/lib/Catmandu/Fix/Condition/marc_has_ref.pm
+++ b/lib/Catmandu/Fix/Condition/marc_has_ref.pm
@@ -1,4 +1,4 @@
-package Catmandu::Fix::Condition::marc_has_ref;
+package Catmandu::Fix::Condition::marc_spec_has;
 use Catmandu::Sane;
 use Catmandu::Fix::marc_spec;
 use Catmandu::Fix::Condition::exists;
@@ -38,13 +38,13 @@ sub emit {
 
 =head1 NAME
 
-Catmandu::Fix::Condition::marc_has_ref - Test if a MARCspec references data
+Catmandu::Fix::Condition::marc_spec_has - Test if a MARCspec references data
 
 =head1 SYNOPSIS
 
-   # marc_has_ref(MARCspec)
+   # marc_spec_has(MARCspec)
 
-   unless marc_has_ref('LDR{/6=\a}{/7=\a|/7=\c|/7=\d|/7=\m}')
+   unless marc_spec_has('LDR{/6=\a}{/7=\a|/7=\c|/7=\d|/7=\m}')
 set_field('type','Book')
end
 
@@ -52,7 +52,7 @@ Catmandu::Fix::Condition::marc_has_ref - Test if a MARCspec 
references data
 
 Evaluate the enclosing fixes only if the MARCspec does reference data.
 
-Does the same like  L but uses 
+Does the same like  L but uses
 MARCspec - A common MARC record path language.
 
 See Lhttp://marcspec.github.io/MARCspec/>
@@ -60,7 +60,7 @@ for documentation on the path syntax.
 
 =head1 METHODS
 
-=head2 marc_has_ref(MARCspec)
+=head2 marc_spec_has(MARCspec)
 
 Evaluates to true when the MARCspec references data, false otherwise.
 
diff --git a/t/25-marc_has_ref.t b/t/25-marc_spec_has.t
similarity index 81%
rename from t/25-marc_has_ref.t
rename to t/25-marc_spec_has.t
index 8bbe7e2..e10b543 100644
--- a/t/25-marc_has_ref.t
+++ b/t/25-marc_spec_has.t
@@ -12,11 +12,11 @@ use Catmandu::Fix;
 
 
 my $fixes = <

[libcatmandu-marc-perl] 188/208: Fixing 0 as undef bug for marc_spec

2017-10-27 Thread Jonas Smedegaard
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 b3da71dbab0b44fe096ab21455dcf85612241132
Author: Carsten Klee 
Date:   Thu Jul 13 08:01:04 2017 +0200

Fixing 0 as undef bug for marc_spec
---
 lib/Catmandu/Fix/marc_spec.pm | 4 ++--
 t/21-marc-spec.t  | 2 ++
 t/marc_spec.fix   | 2 ++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/Catmandu/Fix/marc_spec.pm b/lib/Catmandu/Fix/marc_spec.pm
index 652219d..62d0aaf 100644
--- a/lib/Catmandu/Fix/marc_spec.pm
+++ b/lib/Catmandu/Fix/marc_spec.pm
@@ -45,10 +45,10 @@ sub emit {
 my $perl = "";
 $perl .= $fixer->emit_declare_vars($current_value, "[]");
 $perl .=<marc_spec(
+if (defined(my ${result} = ${marc}->marc_spec(
 ${var},
 ${marc_spec},
-${marc_opt}) ) {
+${marc_opt})) ) {
 ${result} = ref(${result}) ? ${result} : [${result}];
 for ${current_value} (\@{${result}}) {
 EOF
diff --git a/t/21-marc-spec.t b/t/21-marc-spec.t
index b8456c2..dfeacfe 100644
--- a/t/21-marc-spec.t
+++ b/t/21-marc-spec.t
@@ -149,5 +149,7 @@ is $records->[0]->{my}{level2}{inverted}, 'black 
leatherblue pigskin', q|fix: ma
 is $records->[0]->{my}{level1}{inverted}, 'ebinding', q|fix: 
marc_spec('020[#]$a$q[#]/1-5', my.level1.inverted, invert:1);|;
 is $records->[0]->{my}{multi}{level1}{inverted}, 'bleatherbigskinebinding', 
q|fix: marc_spec('020[#]$a$q[0]/1-5$q[1]/1-5$q[2]/1-5', 
my.multi.level1.inverted, invert:1);|;
 
+is $records->[0]->{my}{nullvalue} , '0' , q|fix: marc_spec('008/0', 
my.nullvalue);|;
+
 
 done_testing;
\ No newline at end of file
diff --git a/t/marc_spec.fix b/t/marc_spec.fix
index 1b35d92..842e0c5 100644
--- a/t/marc_spec.fix
+++ b/t/marc_spec.fix
@@ -60,3 +60,5 @@ marc_spec('260[#]$b$a', my.level3.inverted, invert:1)
 marc_spec('020$a$q[#]', my.level2.inverted, invert:1)
 marc_spec('020[#]$a$q[#]/1-5', my.level1.inverted, invert:1)
 marc_spec('020[#]$a$q[0]/1-5$q[1]/1-5$q[2]/1-5', my.multi.level1.inverted, 
invert:1)
+
+marc_spec('008/0', my.nullvalue)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 187/208: 1.17

2017-10-27 Thread Jonas Smedegaard
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 2004832841bb95c4d078feb8c44b984d6e34e0dd
Author: Patrick Hochstenbach 
Date:   Wed Jul 12 11:46:40 2017 +0200

1.17
---
 Build.PL | 2 +-
 Changes  | 2 ++
 lib/Catmandu/Exporter/MARC.pm| 2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/Base.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm| 2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Exporter/MARC/XML.pm| 2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   | 2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  | 2 +-
 lib/Catmandu/Fix/marc_add.pm | 2 +-
 lib/Catmandu/Fix/marc_append.pm  | 2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm | 2 +-
 lib/Catmandu/Fix/marc_in_json.pm | 2 +-
 lib/Catmandu/Fix/marc_map.pm | 2 +-
 lib/Catmandu/Fix/marc_paste.pm   | 2 +-
 lib/Catmandu/Fix/marc_remove.pm  | 2 +-
 lib/Catmandu/Fix/marc_replace_all.pm | 2 +-
 lib/Catmandu/Fix/marc_set.pm | 2 +-
 lib/Catmandu/Fix/marc_spec.pm| 2 +-
 lib/Catmandu/Fix/marc_xml.pm | 2 +-
 lib/Catmandu/Importer/MARC.pm| 2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm| 2 +-
 lib/Catmandu/Importer/MARC/ISO.pm| 2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   | 2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   | 2 +-
 lib/Catmandu/Importer/MARC/RAW.pm| 2 +-
 lib/Catmandu/Importer/MARC/Record.pm | 2 +-
 lib/Catmandu/Importer/MARC/XML.pm| 2 +-
 lib/Catmandu/MARC.pm | 2 +-
 40 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/Build.PL b/Build.PL
index 2960a09..7f67e62 100644
--- a/Build.PL
+++ b/Build.PL
@@ -18,7 +18,7 @@ my %module_build_args = (
 "Patrick Hochstenbach, C<<  >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.161",
+  "dist_version" => "1.17",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index 14b98b1..cbf7284 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+
+1.17  2017-07-12 11:45:56 CEST
   - Fixing 0 as false bug when using from/until
   - Fixing double fix execution bug
   - Using better subfield defaults for marc_set
diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index f653520..42ab1c2 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -3,7 +3,7 @@ use Catmandu::Sane;
 use Catmandu::Util;
 use Moo;
 
-our $VERSION = '1.161';
+our $VERSION = '1.17';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
 has _exporter  => (is => 'ro');
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index 8696029..92f6661 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -58,7 +58,7 @@ use Catmandu::Util qw(xml_escape is_different :array :is);
 use List::Util;
 use Moo;
 
-our $VERSION = '1.161';
+our $VERSION = '1.17';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/Base.pm 
b/lib/Catmandu/Exporter/MARC/Base.pm
index c739119..8c02c0a 100644
--- a/lib/Catmandu/Exporter/MARC/Base.pm
+++ b/lib/Catmandu/Exporter/MARC/Base.pm
@@ -3,7 +3,7 @@ use Moo::Role;
 use MARC::Record;
 use MARC::Field;
 
-our $VERSION = '1.161';
+our $VERSION = '1.17';
 
 sub _raw_to_marc_record {
 my ($self,$data) = @_;
diff --git a/lib/Catmandu/Exporter/MARC/ISO.pm 
b/lib/Catmandu/Exporter/MARC/ISO.pm
index eadba7b..4f5693d 100644
--- a/lib/Catmandu/Exporter/MARC/ISO.pm
+++ b/lib/Catmandu/Exporter/MARC/ISO.pm
@@ -60,7 +60,7 @@ use MARC::Record;
 use MARC::Field;
 use MARC::File::USMARC;
 
-our $VERSION = '1.161';
+our $VERSION = '1.17';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/MARCMaker.pm 

[libcatmandu-marc-perl] 160/208: Merge branch 'marc_has_ref' of https://github.com/cKlee/Catmandu-MARC into cKlee-marc_has_ref

2017-10-27 Thread Jonas Smedegaard
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 19cb17b2f86b34023ef069afe1861170301a1dfc
Merge: f41d2f1 35998ab
Author: Patrick Hochstenbach 
Date:   Thu Jun 29 14:34:04 2017 +0200

Merge branch 'marc_has_ref' of https://github.com/cKlee/Catmandu-MARC into 
cKlee-marc_has_ref

 lib/Catmandu/Fix/Condition/marc_has_ref.pm | 81 ++
 lib/Catmandu/MARC.pm   |  2 +
 t/25-marc_has_ref.t| 31 
 3 files changed, 114 insertions(+)


-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 199/208: Adding explicit all_match , any_match operations

2017-10-27 Thread Jonas Smedegaard
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 ec685a6104a680f408a09fb42454ec3ccd1d70dc
Author: Patrick Hochstenbach 
Date:   Wed Sep 27 12:24:47 2017 +0200

Adding explicit all_match , any_match operations
---
 .../Condition/{marc_match.pm => marc_all_match.pm} | 28 +---
 lib/Catmandu/Fix/Condition/marc_any_match.pm   | 81 ++
 lib/Catmandu/Fix/Condition/marc_match.pm   | 10 +--
 3 files changed, 106 insertions(+), 13 deletions(-)

diff --git a/lib/Catmandu/Fix/Condition/marc_match.pm 
b/lib/Catmandu/Fix/Condition/marc_all_match.pm
similarity index 58%
copy from lib/Catmandu/Fix/Condition/marc_match.pm
copy to lib/Catmandu/Fix/Condition/marc_all_match.pm
index 26230ed..514bd0a 100644
--- a/lib/Catmandu/Fix/Condition/marc_match.pm
+++ b/lib/Catmandu/Fix/Condition/marc_all_match.pm
@@ -1,4 +1,4 @@
-package Catmandu::Fix::Condition::marc_match;
+package Catmandu::Fix::Condition::marc_all_match;
 use Catmandu::Sane;
 use Catmandu::Fix::marc_map;
 use Catmandu::Fix::Condition::all_match;
@@ -23,7 +23,7 @@ sub emit {
 my $marc_map = Catmandu::Fix::marc_map->new($self->marc_path , 
"$tmp_var.\$append");
 $perl .= $marc_map->emit($fixer,$label);
 
-my $all_match = 
Catmandu::Fix::Condition::all_match->new("$tmp_var.*",$self->value);
+my $all_match= 
Catmandu::Fix::Condition::all_match->new("$tmp_var.*",$self->value);
 my $remove_field = Catmandu::Fix::remove_field->new($tmp_var);
 
 my $pass_fixes = $self->pass_fixes;
@@ -39,30 +39,42 @@ sub emit {
 
 =head1 NAME
 
-Catmandu::Fix::Condition::marc_match - Test if a MARC (sub)field matches a 
value
+Catmandu::Fix::Condition::marc_all_match - Test if a MARC (sub)field matches a 
value
 
 =head1 SYNOPSIS
 
-   # marc_match(MARC_PATH,REGEX)
+   # marc_all_match(MARC_PATH,REGEX)
 
-   if marc_match('245','My funny title')
+   # Match if 245 contains the value "My funny title"
+   if marc_all_match('245','My funny title')
add_field('my.funny.title','true')
end
 
+   # Match if 245a contains the value "My funny title"
+   if marc_all_match('245a','My funny title')
+   add_field('my.funny.title','true')
+   end
+
+   # Match if all 650 fields contain digits
+   if marc_all_match('650','[0-9]')
+ add_field('has_digits','true')
+   end
+
 =head1 DESCRIPTION
 
 Evaluate the enclosing fixes only if the MARC (sub)field matches a
-regular expression.
+regular expression. When the MARC field is a repeated fiels, then all
+the MARC fields should match the regular expression.
 
 =head1 METHODS
 
-=head2 marc_match(MARC_PATH, REGEX)
+=head2 marc_all_match(MARC_PATH, REGEX)
 
 Evaluates to true when the MARC_PATH values matches the REGEX, false otherwise.
 
 =head1 SEE ALSO
 
-L
+L
 
 =cut
 
diff --git a/lib/Catmandu/Fix/Condition/marc_any_match.pm 
b/lib/Catmandu/Fix/Condition/marc_any_match.pm
new file mode 100644
index 000..2165928
--- /dev/null
+++ b/lib/Catmandu/Fix/Condition/marc_any_match.pm
@@ -0,0 +1,81 @@
+package Catmandu::Fix::Condition::marc_any_match;
+use Catmandu::Sane;
+use Catmandu::Fix::marc_map;
+use Catmandu::Fix::Condition::any_match;
+use Catmandu::Fix::set_field;
+use Catmandu::Fix::remove_field;
+use Moo;
+use Catmandu::Fix::Has;
+
+our $VERSION = '1.18';
+
+with 'Catmandu::Fix::Condition';
+
+has marc_path  => (fix_arg => 1);
+has value  => (fix_arg => 1);
+
+sub emit {
+my ($self,$fixer,$label) = @_;
+
+my $perl;
+
+my $tmp_var  = '_tmp_' . int(rand());
+my $marc_map = Catmandu::Fix::marc_map->new($self->marc_path , 
"$tmp_var.\$append");
+$perl .= $marc_map->emit($fixer,$label);
+
+my $any_match= 
Catmandu::Fix::Condition::any_match->new("$tmp_var.*",$self->value);
+my $remove_field = Catmandu::Fix::remove_field->new($tmp_var);
+
+my $pass_fixes = $self->pass_fixes;
+my $fail_fixes = $self->fail_fixes;
+
+$any_match->pass_fixes([ $remove_field , @$pass_fixes ]);
+$any_match->fail_fixes([ $remove_field , @$fail_fixes ]);
+
+$perl .= $any_match->emit($fixer,$label);
+
+$perl;
+}
+
+=head1 NAME
+
+Catmandu::Fix::Condition::marc_any_match - Test if a MARC (sub)field matches a 
value
+
+=head1 SYNOPSIS
+
+   # marc_any_match(MARC_PATH,REGEX)
+
+   # Match if 245 contains the value "My funny title"
+   if marc_any_match('245','My funny title')
+   add_field('my.funny.title','true')
+   end
+
+   # Match if 245a contains the value "My funny title"
+   if marc_any_match('245a','My funny title')
+   add_field('my.funny.title','true')
+   end
+
+   # Match if at least one 650 field contains digits
+   if marc_any_match('650','[0-9]')
+ add_field('has_digits','true')
+   end
+
+=head1 DESCRIPTION
+
+Evaluate the enclosing fixes only if the MARC (sub)field matches a
+regular expression. When the MARC field is a repeated fiels, then at
+least one MARC fields 

[libcatmandu-marc-perl] 173/208: Adding marc_paste

2017-10-27 Thread Jonas Smedegaard
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 795197c70a5803fb43d83690e515a211a7935c7a
Author: Patrick Hochstenbach 
Date:   Tue Jul 4 11:19:18 2017 +0200

Adding marc_paste
---
 Build.PL   |  2 ++
 README.md  |  1 +
 lib/Catmandu/Fix/marc_paste.pm | 80 ++
 lib/Catmandu/MARC.pm   | 52 ++-
 t/28_marc_paste.t  | 44 +++
 5 files changed, 178 insertions(+), 1 deletion(-)

diff --git a/Build.PL b/Build.PL
index 02b6076..3a766ad 100644
--- a/Build.PL
+++ b/Build.PL
@@ -46,6 +46,7 @@ my %module_build_args = (
 "Test::More" => "1.001003",
 "Test::Pod" => 0,
 "Test::Simple" => "1.001003",
+"Test::Warn" => 0,
 "Test::Warnings" => 0,
 "XML::XPath" => "1.13"
   }
@@ -59,6 +60,7 @@ my %fallback_build_requires = (
   "Test::More" => "1.001003",
   "Test::Pod" => 0,
   "Test::Simple" => "1.001003",
+  "Test::Warn" => 0,
   "Test::Warnings" => 0,
   "XML::XPath" => "1.13"
 );
diff --git a/README.md b/README.md
index 814a750..12325cb 100644
--- a/README.md
+++ b/README.md
@@ -56,6 +56,7 @@ Catmandu::MARC - Catmandu modules for working with MARC data
 - 
[Catmandu::Fix::marc\_in\_json](https://metacpan.org/pod/Catmandu::Fix::marc_in_json)
 - 
[Catmandu::Fix::marc\_decode\_dollar\_subfields](https://metacpan.org/pod/Catmandu::Fix::marc_decode_dollar_subfields)
 - [Catmandu::Fix::marc\_set](https://metacpan.org/pod/Catmandu::Fix::marc_set)
+- 
[Catmandu::Fix::marc\_struc](https://metacpan.org/pod/Catmandu::Fix::marc_struc)
 - 
[Catmandu::Fix::Bind::marc\_each](https://metacpan.org/pod/Catmandu::Fix::Bind::marc_each)
 - 
[Catmandu::Fix::Condition::marc\_match](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_match)
 - 
[Catmandu::Fix::Condition::marc\_has](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_has)
diff --git a/lib/Catmandu/Fix/marc_paste.pm b/lib/Catmandu/Fix/marc_paste.pm
new file mode 100644
index 000..0ef7182
--- /dev/null
+++ b/lib/Catmandu/Fix/marc_paste.pm
@@ -0,0 +1,80 @@
+package Catmandu::Fix::marc_paste;
+
+use Catmandu::Sane;
+use Catmandu::MARC;
+use Moo;
+use Catmandu::Fix::Has;
+
+with 'Catmandu::Fix::Inlineable';
+
+our $VERSION = '1.15';
+
+has path   => (fix_arg => 1);
+
+sub fix {
+my ($self, $data) = @_;
+my $path = $self->path;
+return Catmandu::MARC->instance->marc_paste($data,$path);
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Catmandu::Fix::marc_paste - paste a MARC structured field back into the MARC 
record
+
+=head1 SYNOPSIS
+
+# Copy a field field
+marc_struc(001, fixed001)
+
+# Change it
+set_fieldfixed001.0.tag,002)
+
+# Paste it back into the record
+marc_paste(fixed001)
+
+
+=head1 DESCRIPTION
+
+Paste a MARC stucture created by L back at the end 
of
+a MARC record.
+
+=head1 METHODS
+
+=head2 marc_paste(JSON_PATH)
+
+Paste a MARC struct PATH back in the MARC record
+
+=head1 INLINE
+
+This Fix can be used inline in a Perl script:
+
+use Catmandu::Fix::marc_struc as => 'marc_struc';
+use Catmandu::Fix::marc_paste as => 'marc_paste';
+
+my $data = { record => ['650', ' ', 0, 'a', 'Perl'] };
+
+$data = marc_struc($data,'650','subject');
+$data = marc_paste($data,'subject');
+
+
+=head1 SEE ALSO
+
+=over
+
+=item * L
+
+=back
+
+=head1 LICENSE AND COPYRIGHT
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of either: the GNU General Public License as published
+by the Free Software Foundation; or the Artistic License.
+
+See http://dev.perl.org/licenses/ for more information.
+
+=cut
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index d6fd8d1..f064a9f 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -1046,7 +1046,7 @@ sub marc_struc {
 $self->compile_marc_path($_[2]);
 
 confess "invalid marc path" unless $context;
-carp "path segments like indicators, subfields and substrings are ignored" 
+carp "path segments like indicators, subfields and substrings are ignored"
 if(defined $context->{subfield} or defined $context->{from} or
 defined $context->{ind1} or defined $context->{ind2});
 
@@ -1099,6 +1099,56 @@ sub marc_struc {
 [$fields];
 }
 
+sub marc_paste {
+my $self  = $_[0];
+my $data  = $_[1];
+my $json_path = $_[2];
+
+my $value = Catmandu::Util::data_at($json_path,$data);
+
+return $data unless Catmandu::Util::is_array_ref($value);
+
+my @new_parts;
+
+for my $part (@$value) {
+return $data unless
+Catmandu::Util::is_hash_ref($part) &&
+exists $part->{tag}  &&
+exists $part->{ind1} &&
+exists $part->{ind2} &&
+( exists $part->{content} || 

[libcatmandu-marc-perl] 167/208: Updating POD

2017-10-27 Thread Jonas Smedegaard
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 3096e92551184bfcc2a6ab6aed151fadff4ebbae
Author: Patrick Hochstenbach 
Date:   Thu Jun 29 16:01:29 2017 +0200

Updating POD
---
 lib/Catmandu/Fix/marc_remove.pm  |  2 +-
 lib/Catmandu/Fix/marc_replace_all.pm | 30 +++
 lib/Catmandu/Fix/marc_set.pm |  4 +--
 lib/Catmandu/MARC.pm | 58 
 4 files changed, 72 insertions(+), 22 deletions(-)

diff --git a/lib/Catmandu/Fix/marc_remove.pm b/lib/Catmandu/Fix/marc_remove.pm
index f653a08..62087e6 100644
--- a/lib/Catmandu/Fix/marc_remove.pm
+++ b/lib/Catmandu/Fix/marc_remove.pm
@@ -36,7 +36,7 @@ Remove (sub)fields in a MARC record
 
 =head1 METHODS
 
-=head2 marc_remove( MARC_PATH , [OPT1:VAL, OPT2: VAL])
+=head2 marc_remove(MARC_PATH)
 
 Delete the (sub)fields from the MARC record as indicated by the MARC_PATH.
 
diff --git a/lib/Catmandu/Fix/marc_replace_all.pm 
b/lib/Catmandu/Fix/marc_replace_all.pm
index 3363fb5..1f0e2de 100644
--- a/lib/Catmandu/Fix/marc_replace_all.pm
+++ b/lib/Catmandu/Fix/marc_replace_all.pm
@@ -23,44 +23,36 @@ sub fix {
 
 =head1 NAME
 
-Catmandu::Fix::marc_set - set a marc value of one (sub)field to a new value
+Catmandu::Fix::marc_replace_all - regex replace (sub)field values in a MARC 
file
 
 =head1 SYNOPSIS
 
-# Set a field in the leader
-if marc_match('LDR/6','c')
-marc_set('LDR/6','p')
-end
+# Append to all the 650-p values the string "xyz"
+marc_replace_all('650p','$','xyz')
 
-# Set all the 650-p fields to 'test'
-marc_set('650p','test')
-
-# Set the 100-a subfield where indicator-1 is 3
-marc_set('100[3]a','Farquhar family.')
-
-# Copy data from another field in a subfield
-marc_set('100a','$.my.deep.field')
+# Replace all 'Joe'-s in 100a to 'Joey'
+marc_replace_all('100a','\bJoe\b','Joey')
 
 =head1 DESCRIPTION
 
-Set the value of a MARC subfield to a new value.
+Use regex search and replace on MARC field values.
 
 =head1 METHODS
 
-=head2 marc_set( MARC_PATH , VALUE , [OPT1:VAL, OPT2: VAL])
+=head2 marc_replace_all(MARC_PATH , REGEX, VALUE)
 
-Set a MARC subfield to a particular new value. This valeu can be a literal or
-reference an existing field in the record using the dollar JSON_PATH syntax.
+For each (sub)field matching the MARC_PATH replace the pattern found by REGEX 
to
+a new VALUE
 
 =head1 INLINE
 
 This Fix can be used inline in a Perl script:
 
-use Catmandu::Fix::marc_set as => 'marc_xmarc_setml';
+use Catmandu::Fix::marc_replace_all as => 'marc_replace_all';
 
 my $data = { record => [...] };
 
-$data = marc_set($data, '245a', 'test');
+$data = marc_replace_all($data, '245a', 'test' , 'rest');
 
 =head1 SEE ALSO
 
diff --git a/lib/Catmandu/Fix/marc_set.pm b/lib/Catmandu/Fix/marc_set.pm
index b6d02e9..e8098ab 100644
--- a/lib/Catmandu/Fix/marc_set.pm
+++ b/lib/Catmandu/Fix/marc_set.pm
@@ -45,7 +45,7 @@ Set the value of a MARC subfield to a new value.
 
 =head1 METHODS
 
-=head2 marc_set( MARC_PATH , VALUE , [OPT1:VAL, OPT2: VAL])
+=head2 marc_set(MARC_PATH , VALUE)
 
 Set a MARC subfield to a particular new value. This valeu can be a literal or
 reference an existing field in the record using the dollar JSON_PATH syntax.
@@ -54,7 +54,7 @@ reference an existing field in the record using the dollar 
JSON_PATH syntax.
 
 This Fix can be used inline in a Perl script:
 
-use Catmandu::Fix::marc_set as => 'marc_xmarc_setml';
+use Catmandu::Fix::marc_set as => 'marc_set';
 
 my $data = { record => [...] };
 
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index b18863c..f8b4531 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -264,6 +264,64 @@ sub marc_replace_all {
 $data;
 }
 
+sub marc_replace_all {
+my ($self,$data,$marc_path,$regex,$value) = @_;
+my $record = $data->{'record'};
+
+return $data unless defined $record;
+
+if ($value =~ /^\$\.(\S+)/) {
+my $path = $1;
+$value = Catmandu::Util::data_at($path,$data);
+}
+
+if (Catmandu::Util::is_array_ref $value) {
+$value = $value->[-1];
+}
+elsif (Catmandu::Util::is_hash_ref $value) {
+my $last;
+for (keys %$value) {
+$last = $value->{$_};
+}
+$value = $last;
+}
+
+my $context = $self->compile_marc_path($marc_path, subfield_wildcard => 1);
+
+confess "invalid marc path" unless $context;
+
+for my $field (@$record) {
+my ($tag, $ind1, $ind2, @subfields) = @$field;
+
+if ($context->{is_regex_field}) {
+next unless $tag =~ $context->{field_regex};
+}
+else {
+next unless $tag eq $context->{field};
+}
+
+if (defined $context->{ind1}) {
+if (!defined $ind1 || $ind1 ne $context->{ind1}) {

[libcatmandu-marc-perl] 163/208: Merge branch 'cKlee-marc_has_ref' into dev

2017-10-27 Thread Jonas Smedegaard
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 f2670156ff2b55c1cc6e7d52d03cebb1989a37ce
Merge: f41d2f1 409d426
Author: Patrick Hochstenbach 
Date:   Thu Jun 29 14:39:37 2017 +0200

Merge branch 'cKlee-marc_has_ref' into dev

 Build.PL|  2 +-
 README.md   |  1 +
 lib/Catmandu/Fix/Condition/marc_spec_has.pm | 81 +
 lib/Catmandu/MARC.pm|  2 +
 t/25-marc_spec_has.t| 31 +++
 5 files changed, 116 insertions(+), 1 deletion(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 159/208: Merge branch 'master' of https://github.com/LibreCat/Catmandu-MARC into marc_has_ref

2017-10-27 Thread Jonas Smedegaard
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 dc862b203470d9ae39c78a4be088ba71ea84065d
Merge: 35998ab 4f32eea
Author: Carsten Klee 
Date:   Thu Jun 29 12:00:27 2017 +0200

Merge branch 'master' of https://github.com/LibreCat/Catmandu-MARC into 
marc_has_ref

pulled from master

 Build.PL | 2 +-
 Changes  | 2 ++
 lib/Catmandu/Exporter/MARC.pm| 2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/Base.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm| 2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Exporter/MARC/XML.pm| 2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   | 2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  | 2 +-
 lib/Catmandu/Fix/marc_add.pm | 2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm | 2 +-
 lib/Catmandu/Fix/marc_in_json.pm | 2 +-
 lib/Catmandu/Fix/marc_map.pm | 2 +-
 lib/Catmandu/Fix/marc_remove.pm  | 2 +-
 lib/Catmandu/Fix/marc_set.pm | 2 +-
 lib/Catmandu/Fix/marc_spec.pm| 2 +-
 lib/Catmandu/Fix/marc_xml.pm | 2 +-
 lib/Catmandu/Importer/MARC.pm| 2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm| 2 +-
 lib/Catmandu/Importer/MARC/ISO.pm| 2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   | 2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   | 2 +-
 lib/Catmandu/Importer/MARC/RAW.pm| 2 +-
 lib/Catmandu/Importer/MARC/Record.pm | 2 +-
 lib/Catmandu/Importer/MARC/XML.pm| 2 +-
 lib/Catmandu/MARC.pm | 2 +-
 37 files changed, 38 insertions(+), 36 deletions(-)


-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 171/208: new fix marc_struc

2017-10-27 Thread Jonas Smedegaard
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 1b856949bad73cf21ded4cee47f7addde542af2b
Author: Carsten Klee 
Date:   Fri Jun 30 09:59:30 2017 +0200

new fix marc_struc
---
 cpanfile   |   1 +
 lib/Catmandu/Fix/marc_struc.pm | 187 +++
 lib/Catmandu/MARC.pm   |  64 ++
 t/26-marc_struc.t  | 196 +
 4 files changed, 448 insertions(+)

diff --git a/cpanfile b/cpanfile
index 44fde68..0126702 100644
--- a/cpanfile
+++ b/cpanfile
@@ -5,6 +5,7 @@ on 'test', sub {
   requires 'Test::More', '1.001003';
   requires 'Test::Deep', '0';
   requires 'Test::Warnings', '0';
+  requires 'Test::Warn', '0';
   requires 'XML::XPath', '1.13';
   requires 'Pod::Simple::HTML', '>=3.23';
   requires 'Test::Pod' , '0';
diff --git a/lib/Catmandu/Fix/marc_struc.pm b/lib/Catmandu/Fix/marc_struc.pm
new file mode 100644
index 000..9333cf3
--- /dev/null
+++ b/lib/Catmandu/Fix/marc_struc.pm
@@ -0,0 +1,187 @@
+package Catmandu::Fix::marc_struc;
+
+use Catmandu::Sane;
+use Catmandu::MARC;
+use Moo;
+use Catmandu::Fix::Has;
+
+with 'Catmandu::Fix::Base';
+
+our $VERSION = '1.13';
+
+has marc_path  => (fix_arg => 1);
+has path   => (fix_arg => 1);
+
+sub emit {
+my ($self,$fixer) = @_;
+my $path = $fixer->split_path($self->path);
+my $key  = $path->[-1];
+my $marc_obj = Catmandu::MARC->instance;
+
+# Precompile the marc_path to gain some speed
+my $marc_context = $marc_obj->compile_marc_path($self->marc_path);
+my $marc = $fixer->capture($marc_obj);
+my $marc_path= $fixer->capture($marc_context);
+
+my $var   = $fixer->var;
+my $result= $fixer->generate_var;
+my $current_value = $fixer->generate_var;
+
+my $perl = "";
+$perl .= $fixer->emit_declare_vars($current_value, "[]");
+$perl .=<marc_struc(
+${var},
+${marc_path}) ) {
+${result} = ref(${result}) ? ${result} : [${result}];
+for ${current_value} (\@{${result}}) {
+EOF
+
+$perl .= $fixer->emit_create_path(
+$var,
+$path,
+sub {
+my $var2 = shift;
+"${var2} = ${current_value}"
+}
+);
+
+$perl .=< 'marc_struc';
+
+my $data = { record => ['650', ' ', 0, 'a', 'Perl'] };
+
+$data = marc_struc($data,'650','subject');
+
+print $data->{subject}->[0]->{tag} , "\n"; # '650'
+print $data->{subject}->[0]->{ind1} , "\n"; # ' '
+print $data->{subject}->[0]->{ind2} , "\n"; # 0
+print $data->{subject}->[0]->{subfields}->[0]->{a} , "\n"; # 'Perl'
+
+=head1 SEE ALSO
+
+=over
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=item * L
+
+=back
+
+=head1 LICENSE AND COPYRIGHT
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of either: the GNU General Public License as published
+by the Free Software 

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

2017-10-27 Thread Jonas Smedegaard
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 
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 .=<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

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 153/208: Upgrading Catmandu using new group binds for marc_each

2017-10-27 Thread Jonas Smedegaard
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 18e6ade68cdcde1d24421f6311d46ba51b23b848
Author: Patrick Hochstenbach 
Date:   Thu Jun 22 09:46:27 2017 +0200

Upgrading Catmandu using new group binds for marc_each
---
 Build.PL   |  2 +-
 Changes|  2 ++
 cpanfile   |  2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm | 10 +-
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/Build.PL b/Build.PL
index 5b53e5f..0da7e6f 100644
--- a/Build.PL
+++ b/Build.PL
@@ -24,7 +24,7 @@ my %module_build_args = (
   "recursive_test_files" => 1,
   "requires" => {
 "Carp" => 0,
-"Catmandu" => "1.0201",
+"Catmandu" => "1.0601",
 "JSON::XS" => "2.3",
 "List::Util" => 0,
 "MARC::File::MARCMaker" => "0.05",
diff --git a/Changes b/Changes
index 4b1f008..e374573 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+  - Upgrading to Catmandu 1.06X
+  - Using the Catmandu::Fix::Bind::Group style for marc_each bind
 
 1.13  2017-06-15 09:19:13 CEST
   - Fixing join subfields per field correctly in marc_spec
diff --git a/cpanfile b/cpanfile
index 44fde68..0c3b729 100644
--- a/cpanfile
+++ b/cpanfile
@@ -11,7 +11,7 @@ on 'test', sub {
 };
 
 requires 'Carp', '0';
-requires 'Catmandu', '>=1.0201';
+requires 'Catmandu', '>=1.0601';
 requires 'JSON::XS', '2.3';
 requires 'YAML::XS', '0.34';
 requires 'List::Util', '0';
diff --git a/lib/Catmandu/Fix/Bind/marc_each.pm 
b/lib/Catmandu/Fix/Bind/marc_each.pm
index e4f823a..85a3d82 100644
--- a/lib/Catmandu/Fix/Bind/marc_each.pm
+++ b/lib/Catmandu/Fix/Bind/marc_each.pm
@@ -5,7 +5,7 @@ use Catmandu::Util;
 
 our $VERSION = '1.13';
 
-with 'Catmandu::Fix::Bind';
+with 'Catmandu::Fix::Bind', 'Catmandu::Fix::Bind::Group';
 
 has done => (is => 'ro');
 
@@ -13,12 +13,12 @@ sub unit {
 my ($self,$data) = @_;
 
 $self->{done} = 0;
-
+
 $data;
 }
 
 sub bind {
-my ($self,$mvar,$func,$name,$fixer) = @_;
+my ($self,$mvar,$code) = @_;
 
 return $mvar if $self->done;
 
@@ -30,7 +30,7 @@ sub bind {
 
 $mvar->{record} = [$row];
 
-my $fixed = $fixer->fix($mvar);
+my $fixed = $code->($mvar);
 
 push @new , @{$fixed->{record}} if defined $fixed && exists 
$fixed->{record} && defined $fixed->{record};
 }
@@ -66,7 +66,7 @@ Catmandu::Fix::Bind::marc_each - a binder that loops over 
MARC fields
 
 =head1 DESCRIPTION
 
-The marc_each binder will iterate over each individual MARC field and execute 
the fixes only 
+The marc_each binder will iterate over each individual MARC field and execute 
the fixes only
 in context over each individual field.
 
 If a MARC record contains:

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 01/02: pristine-tar data for libcatmandu-marc-perl_1.03.orig.tar.gz

2017-10-27 Thread Jonas Smedegaard
This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch pristine-tar
in repository libcatmandu-marc-perl.

commit b4f8f3ba00a242328a834b87eea433328802459d
Author: Jonas Smedegaard 
Date:   Sun Dec 25 14:16:58 2016 +0100

pristine-tar data for libcatmandu-marc-perl_1.03.orig.tar.gz
---
 libcatmandu-marc-perl_1.03.orig.tar.gz.delta | Bin 0 -> 4553 bytes
 libcatmandu-marc-perl_1.03.orig.tar.gz.id|   1 +
 2 files changed, 1 insertion(+)

diff --git a/libcatmandu-marc-perl_1.03.orig.tar.gz.delta 
b/libcatmandu-marc-perl_1.03.orig.tar.gz.delta
new file mode 100644
index 000..b32c5ce
Binary files /dev/null and b/libcatmandu-marc-perl_1.03.orig.tar.gz.delta differ
diff --git a/libcatmandu-marc-perl_1.03.orig.tar.gz.id 
b/libcatmandu-marc-perl_1.03.orig.tar.gz.id
new file mode 100644
index 000..a7279d7
--- /dev/null
+++ b/libcatmandu-marc-perl_1.03.orig.tar.gz.id
@@ -0,0 +1 @@
+db52cf161d1da5725e0a63c57955b8a605483f44

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 186/208: Making Travis perl versions in line with Catmandu

2017-10-27 Thread Jonas Smedegaard
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 cbde1e59295f67e410cbcd3ea8837f84fb630440
Author: Patrick Hochstenbach 
Date:   Wed Jul 12 11:33:32 2017 +0200

Making Travis perl versions in line with Catmandu
---
 .travis.yml | 4 +++-
 Changes | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index a3c1621..65d4f8e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,14 @@
 language: perl
 perl:
+  - "5.26"
+  - "5.24"
   - "5.20"
   - "5.18"
   - "5.16"
   - "5.14"
   - "5.12"
   - "5.10"
-install: 
+install:
   - cpanm --quiet --installdeps --notest --force --skip-satisfied .
   - cpanm --quiet --notest --skip-satisfied Devel::Cover
 script:
diff --git a/Changes b/Changes
index 3c8ae4f..14b98b1 100644
--- a/Changes
+++ b/Changes
@@ -4,6 +4,7 @@ Revision history for Catmandu-MARC
   - Fixing 0 as false bug when using from/until
   - Fixing double fix execution bug
   - Using better subfield defaults for marc_set
+  - Adding 'marc_cut' fix
 
 1.161  2017-07-06 14:36:29 CEST
   - Fixing marc_replace_all evaluating search groups

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 02/02: pristine-tar data for libcatmandu-marc-perl_1.19.orig.tar.gz

2017-10-27 Thread Jonas Smedegaard
This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch pristine-tar
in repository libcatmandu-marc-perl.

commit 2f353ce17759b5e7fba2b0ec8f19e3ae95ddbfc1
Author: Jonas Smedegaard 
Date:   Sat Oct 28 05:11:32 2017 +0200

pristine-tar data for libcatmandu-marc-perl_1.19.orig.tar.gz
---
 libcatmandu-marc-perl_1.19.orig.tar.gz.delta | Bin 0 -> 5757 bytes
 libcatmandu-marc-perl_1.19.orig.tar.gz.id|   1 +
 2 files changed, 1 insertion(+)

diff --git a/libcatmandu-marc-perl_1.19.orig.tar.gz.delta 
b/libcatmandu-marc-perl_1.19.orig.tar.gz.delta
new file mode 100644
index 000..5084d69
Binary files /dev/null and b/libcatmandu-marc-perl_1.19.orig.tar.gz.delta differ
diff --git a/libcatmandu-marc-perl_1.19.orig.tar.gz.id 
b/libcatmandu-marc-perl_1.19.orig.tar.gz.id
new file mode 100644
index 000..eae7d3c
--- /dev/null
+++ b/libcatmandu-marc-perl_1.19.orig.tar.gz.id
@@ -0,0 +1 @@
+ab7532821e4cd294c2e5f4cd389e48b4c2e3f52c

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 165/208: Adding support for marc_replace_all

2017-10-27 Thread Jonas Smedegaard
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 b3eab17f0e9477e87d08780d3e438498638e987c
Author: Patrick Hochstenbach 
Date:   Thu Jun 29 15:50:13 2017 +0200

Adding support for marc_replace_all
---
 README.md|  2 +-
 lib/Catmandu/Fix/marc_replace_all.pm | 71 
 lib/Catmandu/MARC.pm | 61 ++-
 t/26_marc_replace_all.t  | 35 ++
 4 files changed, 166 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 2f48900..794c75c 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ Catmandu::MARC - Catmandu modules for working with MARC data
 - 
[Catmandu::Fix::Condition::marc\_match](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_match)
 - 
[Catmandu::Fix::Condition::marc\_has](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_has)
 - 
[Catmandu::Fix::Condition::marc\_has\_many](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_has_many)
-- 
[Catmandu::Fix::Condition::marc\_has\_ref](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_has_ref)
+- 
[Catmandu::Fix::Condition::marc\_spec\_has](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_spec_has)
 - 
[Catmandu::Fix::Inline::marc\_map](https://metacpan.org/pod/Catmandu::Fix::Inline::marc_map)
 - 
[Catmandu::Fix::Inline::marc\_add](https://metacpan.org/pod/Catmandu::Fix::Inline::marc_add)
 - 
[Catmandu::Fix::Inline::marc\_remove](https://metacpan.org/pod/Catmandu::Fix::Inline::marc_remove)
diff --git a/lib/Catmandu/Fix/marc_replace_all.pm 
b/lib/Catmandu/Fix/marc_replace_all.pm
new file mode 100644
index 000..3363fb5
--- /dev/null
+++ b/lib/Catmandu/Fix/marc_replace_all.pm
@@ -0,0 +1,71 @@
+package Catmandu::Fix::marc_replace_all;
+
+use Catmandu::Sane;
+use Moo;
+use Catmandu::MARC;
+use Catmandu::Fix::Has;
+
+with 'Catmandu::Fix::Inlineable';
+
+our $VERSION = '1.14';
+
+has marc_path  => (fix_arg => 1);
+has regex  => (fix_arg => 1);
+has value  => (fix_arg => 1);
+
+sub fix {
+my ($self,$data) = @_;
+my $marc_path   = $self->marc_path;
+my $regex   = $self->regex;
+my $value   = $self->value;
+return 
Catmandu::MARC->instance->marc_replace_all($data,$marc_path,$regex,$value);
+}
+
+=head1 NAME
+
+Catmandu::Fix::marc_set - set a marc value of one (sub)field to a new value
+
+=head1 SYNOPSIS
+
+# Set a field in the leader
+if marc_match('LDR/6','c')
+marc_set('LDR/6','p')
+end
+
+# Set all the 650-p fields to 'test'
+marc_set('650p','test')
+
+# Set the 100-a subfield where indicator-1 is 3
+marc_set('100[3]a','Farquhar family.')
+
+# Copy data from another field in a subfield
+marc_set('100a','$.my.deep.field')
+
+=head1 DESCRIPTION
+
+Set the value of a MARC subfield to a new value.
+
+=head1 METHODS
+
+=head2 marc_set( MARC_PATH , VALUE , [OPT1:VAL, OPT2: VAL])
+
+Set a MARC subfield to a particular new value. This valeu can be a literal or
+reference an existing field in the record using the dollar JSON_PATH syntax.
+
+=head1 INLINE
+
+This Fix can be used inline in a Perl script:
+
+use Catmandu::Fix::marc_set as => 'marc_xmarc_setml';
+
+my $data = { record => [...] };
+
+$data = marc_set($data, '245a', 'test');
+
+=head1 SEE ALSO
+
+L
+
+=cut
+
+1;
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index d6fe6f1..02437c7 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -207,6 +207,63 @@ sub marc_add {
 $data;
 }
 
+sub marc_replace_all {
+my ($self,$data,$marc_path,$regex,$value) = @_;
+my $record = $data->{'record'};
+
+return $data unless defined $record;
+
+if ($value =~ /^\$\.(\S+)/) {
+my $path = $1;
+$value = Catmandu::Util::data_at($path,$data);
+}
+
+if (Catmandu::Util::is_array_ref $value) {
+$value = $value->[-1];
+}
+elsif (Catmandu::Util::is_hash_ref $value) {
+my $last;
+for (keys %$value) {
+$last = $value->{$_};
+}
+$value = $last;
+}
+
+my $context = $self->compile_marc_path($marc_path, subfield_wildcard => 1);
+
+confess "invalid marc path" unless $context;
+
+for my $field (@$record) {
+my ($tag, $ind1, $ind2, @subfields) = @$field;
+
+if ($context->{is_regex_field}) {
+next unless $tag =~ $context->{field_regex};
+}
+else {
+next unless $tag eq $context->{field};
+}
+
+if (defined $context->{ind1}) {
+if (!defined $ind1 || $ind1 ne $context->{ind1}) {
+next;
+}
+}
+if (defined $context->{ind2}) {
+if (!defined $ind2 || $ind2 ne $context->{ind2}) {
+next;
+}
+}
+
+for (my $i = 0; $i < 

[libcatmandu-marc-perl] 162/208: Renamig marc_has_ref to marc_spec_has

2017-10-27 Thread Jonas Smedegaard
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 409d42606da8a6076303401528a272d6440f8e76
Author: Patrick Hochstenbach 
Date:   Thu Jun 29 14:38:49 2017 +0200

Renamig marc_has_ref to marc_spec_has
---
 README.md| 1 +
 lib/Catmandu/Fix/Condition/{marc_has_ref.pm => marc_spec_has.pm} | 0
 2 files changed, 1 insertion(+)

diff --git a/README.md b/README.md
index 11772a9..2f48900 100644
--- a/README.md
+++ b/README.md
@@ -58,6 +58,7 @@ Catmandu::MARC - Catmandu modules for working with MARC data
 - 
[Catmandu::Fix::Condition::marc\_match](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_match)
 - 
[Catmandu::Fix::Condition::marc\_has](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_has)
 - 
[Catmandu::Fix::Condition::marc\_has\_many](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_has_many)
+- 
[Catmandu::Fix::Condition::marc\_has\_ref](https://metacpan.org/pod/Catmandu::Fix::Condition::marc_has_ref)
 - 
[Catmandu::Fix::Inline::marc\_map](https://metacpan.org/pod/Catmandu::Fix::Inline::marc_map)
 - 
[Catmandu::Fix::Inline::marc\_add](https://metacpan.org/pod/Catmandu::Fix::Inline::marc_add)
 - 
[Catmandu::Fix::Inline::marc\_remove](https://metacpan.org/pod/Catmandu::Fix::Inline::marc_remove)
diff --git a/lib/Catmandu/Fix/Condition/marc_has_ref.pm 
b/lib/Catmandu/Fix/Condition/marc_spec_has.pm
similarity index 100%
rename from lib/Catmandu/Fix/Condition/marc_has_ref.pm
rename to lib/Catmandu/Fix/Condition/marc_spec_has.pm

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 197/208: Adding more POD in the tutorial

2017-10-27 Thread Jonas Smedegaard
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 f78321cc5e54206b183d276733d65309af7fa2bc
Author: Patrick Hochstenbach 
Date:   Sun Jul 23 10:47:38 2017 +0200

Adding more POD in the tutorial
---
 lib/Catmandu/MARC.pm   |  2 +
 lib/Catmandu/MARC/Tutorial.pod | 85 ++
 2 files changed, 39 insertions(+), 48 deletions(-)

diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 7b9920a..9a137a7 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -1342,6 +1342,8 @@ Catmandu::MARC - Catmandu modules for working with MARC 
data
 
 =over
 
+=item * L
+
 =item * L
 
 =item * L
diff --git a/lib/Catmandu/MARC/Tutorial.pod b/lib/Catmandu/MARC/Tutorial.pod
index 0e97114..75c20ec 100644
--- a/lib/Catmandu/MARC/Tutorial.pod
+++ b/lib/Catmandu/MARC/Tutorial.pod
@@ -49,18 +49,36 @@ The C Fix can get one or more subfields to 
extract from MARC:
 In the example below the 650a field can be repeated in some marc records.
 We will join all the repetitions in an comma delimited list for each record.
 
-First we create a Fix file containing all the Fixes, then we execute the
-catmandu command.
+   $ catmandu convert MARC to CSV --fix 'marc_map(650a,subject,join:","); 
retain(subject)' < data.mrc
 
-Open a text editor and create the C file with content:
+=head2 Create a list of all ISBN numbers in the data
 
-marc_map(650a,subject.$append)
-join_field(subject,",")
-retain(subject)
+In the previous example we saw how all subjects can be printed using a few Fix 
commands.
+When a subject is repeated in a record, it will be written on one line joined 
by a comma:
 
-And execute the command:
+subject1
+subject2, subject3
+subject4
 
-   $ catmandu convert MARC to CSV --fix myfix.fix < data.mrc
+In the example over record 1 contained 'subject1', record 2 'subject2' and 
'subject3' and
+record 3 'subject4'. What should we use when we want a list of all values in a 
long list?
+
+In the example below we'll print all ISBN numbers in a batch of MARC records 
in one long list
+using the Text exporter:
+
+  $ catmandu convert MARC to Text --field_sep "\n" --fix 
'marc_map(020a,isbn.\$append); retain(isbn)' < data.mrc
+
+The first new thing is the C<$append> in the marc_map. This will create in 
C a
+list of all ISBN numbers found in the C<020a> field. Because C<$> signs have a 
special meaning on
+the command line they need to be escaped with a backslash C<\>. The C 
exporter with the C
+option will make use all the list in the C field are written on a new 
line.
+
+=head2 Create a list of all unique ISBN numbers in the data
+
+Given the result of the previous command, it is now easy to create a unique 
list of ISBN numbers
+with the UNIX C command:
+
+ $ catmandu convert MARC to Text --field_sep "\n" --fix 
'marc_map(020a,isbn.\$append); retain(isbn)' < data.mrc | uniq
 
 =head2 Create a list of the number of subjects per record
 
@@ -68,6 +86,9 @@ We will create a list of subjects (650a) and count the number 
of items
 in this list for each record. The CSV file will contain the C<_id> (record
 identifier) and C the number of 650a fields.
 
+Writing all Fixes on the command line can become tedious. In Catmandu it is 
possible
+to create a Fix script which contains all the Fix commands.
+
 Open a text editor and create the C file with content:
 
 marc_map(650a,subject.$append)
@@ -78,37 +99,6 @@ And execute the command:
 
$ catmandu convert MARC to CSV --fix myfix.fix < data.mrc
 
-=head2 Create a list of all ISBN numbers in the data
-
-We will create first a Fix script which Cs only the records
-that contain an ISBN field (022$a). All the isbns found we will
-print inline using the C Fix.
-
-Open a text editor and create the C file with content:
-
-marc_map(020a,isbn.$append)
-
-select exists(isbn)
-
-# Loop over the ISBNs and print them to a CSV exporter
-do list(path:isbn,var:c)
- move_field(c,result.isbn)
- add_to_exporter(result,CSV)
-end
-
-Execute the following catmandu command, notice that we ignore the normal
-output with help of the C exporter (all output will be generated)
-by the Fix script:
-
-   $ catmandu convert MARC to Null --fix myfix.fix < data.mrc
-
-=head2 Create a list of all unique ISBN numbers in the data
-
-Here we can use the Fix script as in the previous example and use the
-UNIX "sort -u" command:
-
-   $ catmandu convert MARC to Null --fix myfix.fix < data.mrc | sort -u
-
 =head2 Create a list of all ISBN numbers for records with type 920a == book
 
 In the example we need an extra condition for match the content of the
@@ -119,18 +109,16 @@ Open a text editor and create the C file with 
content:
 marc_map(020a,isbn.$append)
 marc_map(920a,type)
 
-select all_match(type,"book")
-select exists(isbn)
+select 

[libcatmandu-marc-perl] branch pristine-tar updated (bd7dcd7 -> 2f353ce)

2017-10-27 Thread Jonas Smedegaard
This is an automated email from the git hooks/post-receive script.

js pushed a change to branch pristine-tar
in repository libcatmandu-marc-perl.

  from  bd7dcd7   pristine-tar data for 
libcatmandu-marc-perl_0.215.orig.tar.gz
   new  b4f8f3b   pristine-tar data for 
libcatmandu-marc-perl_1.03.orig.tar.gz
   new  2f353ce   pristine-tar data for 
libcatmandu-marc-perl_1.19.orig.tar.gz

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 libcatmandu-marc-perl_1.03.orig.tar.gz.delta | Bin 0 -> 4553 bytes
 libcatmandu-marc-perl_1.03.orig.tar.gz.id|   1 +
 libcatmandu-marc-perl_1.19.orig.tar.gz.delta | Bin 0 -> 5757 bytes
 libcatmandu-marc-perl_1.19.orig.tar.gz.id|   1 +
 4 files changed, 2 insertions(+)
 create mode 100644 libcatmandu-marc-perl_1.03.orig.tar.gz.delta
 create mode 100644 libcatmandu-marc-perl_1.03.orig.tar.gz.id
 create mode 100644 libcatmandu-marc-perl_1.19.orig.tar.gz.delta
 create mode 100644 libcatmandu-marc-perl_1.19.orig.tar.gz.id

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 192/208: Adding the rename of MARC fields to the tutorial

2017-10-27 Thread Jonas Smedegaard
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 3f98196dc9a313d666ece508d52bccaca6bb12b6
Author: Patrick Hochstenbach 
Date:   Thu Jul 20 11:34:32 2017 +0200

Adding the rename of MARC fields to the tutorial
---
 lib/Catmandu/MARC/Tutorial.pod | 29 +
 1 file changed, 29 insertions(+)

diff --git a/lib/Catmandu/MARC/Tutorial.pod b/lib/Catmandu/MARC/Tutorial.pod
index febddf6..8e8ffdc 100644
--- a/lib/Catmandu/MARC/Tutorial.pod
+++ b/lib/Catmandu/MARC/Tutorial.pod
@@ -232,6 +232,35 @@ output
 
 $ catmandu -D convert MARC to Null --fix myfix.fix < data.mrc
 
+=head2 Rename MARC subfields
+
+In the example below we rename each $1 subfield in the MARC record to $0 using
+the L, L and 
L
+fixes:
+
+# For each marc field...
+do marc_each()
+   # Cut the field into tmp..
+   marc_cut(***,tmp)
+
+   # Rename every 1 subfield to 0
+   rename(tmp.*.subfields.*,1,0)
+
+   # And paste it back
+   marc_paste(tmp)
+end
+
+Put this Fix script in a file C and execute the Catmandu command:
+
+  $ catmandu convert MARC to MARC --fix myfix.fix < data.mrc > output.mrc
+
+The C bind will loop over all the MARC fields. With C we
+store any field (C<***> matches every field) into a C field. The 
C
+creates an array structure in C which is easy to process using the Fix
+language. Using the C function we search for all the subfields, and 
replace
+the field matching the regular expression C<1> with C<0>. At the end, we paste
+back the C field into the record.  
+
 =head1 WRITING
 
 =head2 Convert a MARC record into a MARC record (do nothing)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 148/208: Merge branch 'cKlee-mapping_rules_spec' into dev

2017-10-27 Thread Jonas Smedegaard
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 0535eb5ec03d6f69e75021ee8940041fc88183b7
Merge: 6233c59 33c91be
Author: Patrick Hochstenbach 
Date:   Thu Jun 15 08:53:17 2017 +0200

Merge branch 'cKlee-mapping_rules_spec' into dev

 lib/Catmandu/MARC.pm  |  11 ++-
 t/23-mapping_rules_spec.t | 217 --
 2 files changed, 176 insertions(+), 52 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 146/208: subspec comparison failed

2017-10-27 Thread Jonas Smedegaard
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 d2da62a3bb6b6ecfdf8d32cc194f4acf0cfdf26d
Author: Carsten Klee 
Date:   Tue Jun 13 13:36:40 2017 +0200

subspec comparison failed
---
 lib/Catmandu/MARC.pm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 1ba5cea..44bb8d4 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -13,7 +13,6 @@ with 'MooX::Singleton';
 
 memoize('compile_marc_path');
 memoize('parse_marc_spec');
-memoize('_it_subspecs');
 memoize('_get_index_range');
 
 our $VERSION = '1.10';
@@ -688,13 +687,13 @@ sub _validate_subspec {
 
 if($subspec->operator eq '~') {
 foreach my $v ( @{$left_subterm->[0]} ) {
-return 1 if List::Util::any {$v =~ m?$_?} @{$right_subterm}
+return 1 if List::Util::any {$v =~ /$_/} @{$right_subterm}
 }
 }
 
 if($subspec->operator eq '!~') {
 foreach my $v ( @{$left_subterm->[0]} ) {
-return 0 if List::Util::any {$v =~ m?$_?} @{$right_subterm}
+return 0 if List::Util::any {$v =~ /$_/} @{$right_subterm}
 }
 return 1
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 127/208: Merge branch 'cKlee-dev' into dev

2017-10-27 Thread Jonas Smedegaard
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 6cddfcd10c302a215b22da974267a062a6d95d8f
Merge: a1cf140 aad98f9
Author: Patrick Hochstenbach 
Date:   Tue May 2 11:44:13 2017 +0200

Merge branch 'cKlee-dev' into dev

 cpanfile  |   3 +-
 lib/Catmandu/Fix/marc_spec.pm |  66 --
 lib/Catmandu/MARC.pm  | 497 +-
 t/21-marc-spec.t  |  93 
 t/23-mapping_rules_spec.t | 225 ---
 t/24-marc-spec-subspecs.t | 402 ++
 t/camel9.mrc  |   1 +
 t/marc_spec.fix   |   3 +
 8 files changed, 1002 insertions(+), 288 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 157/208: Merge branch 'dev' of https://github.com/cKlee/Catmandu-MARC into marc_has_ref

2017-10-27 Thread Jonas Smedegaard
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 57bff886f7a27d3d3c545be65f0f86b62d43b509
Merge: 454e357 1c90067
Author: Carsten Klee 
Date:   Thu Jun 29 11:21:16 2017 +0200

Merge branch 'dev' of https://github.com/cKlee/Catmandu-MARC into 
marc_has_ref

updated from dev

 Changes  |   6 +++
 lib/Catmandu/MARC.pm | 124 ++-
 2 files changed, 69 insertions(+), 61 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 139/208: Merge branch 'dev' of github.com:LibreCat/Catmandu-MARC into dev

2017-10-27 Thread Jonas Smedegaard
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 49ba9d04e994fa164f70ce9bcdb0fb6f3e7166c1
Merge: 443c9fa be09bcd
Author: Patrick Hochstenbach 
Date:   Mon May 29 10:11:04 2017 +0200

Merge branch 'dev' of github.com:LibreCat/Catmandu-MARC into dev

 Build.PL | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 151/208: Merge branch 'cKlee-dev' into dev

2017-10-27 Thread Jonas Smedegaard
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 2b8cc2b8d89fc490f0bc81753f1b3d44fda12bfa
Merge: 9438625 1c90067
Author: Patrick Hochstenbach 
Date:   Thu Jun 15 09:18:18 2017 +0200

Merge branch 'cKlee-dev' into dev

 Changes   |  5 
 lib/Catmandu/MARC.pm  |  5 ++--
 t/23-mapping_rules_spec.t | 65 +--
 3 files changed, 58 insertions(+), 17 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 137/208: Upgrading MARC::File::XML

2017-10-27 Thread Jonas Smedegaard
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 be09bcd041a46a6aec107573ac0b49892ce46c8c
Author: Patrick Hochstenbach 
Date:   Wed May 24 08:42:58 2017 +0200

Upgrading MARC::File::XML
---
 Build.PL | 4 ++--
 cpanfile | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Build.PL b/Build.PL
index 17b2204..2c1b44c 100644
--- a/Build.PL
+++ b/Build.PL
@@ -1,5 +1,5 @@
 
-# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild 
v6.008.
+# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild 
v6.005.
 use strict;
 use warnings;
 
@@ -29,7 +29,7 @@ my %module_build_args = (
 "List::Util" => 0,
 "MARC::File::MARCMaker" => "0.05",
 "MARC::File::MiJ" => "0.04",
-"MARC::File::XML" => "v1.0.3",
+"MARC::File::XML" => "v1.0.5",
 "MARC::Lint" => 0,
 "MARC::Parser::RAW" => 0,
 "MARC::Record" => "v2.0.6",
diff --git a/cpanfile b/cpanfile
index aaf401f..44fde68 100644
--- a/cpanfile
+++ b/cpanfile
@@ -15,7 +15,7 @@ requires 'Catmandu', '>=1.0201';
 requires 'JSON::XS', '2.3';
 requires 'YAML::XS', '0.34';
 requires 'List::Util', '0';
-requires 'MARC::File::XML', '1.0.3';
+requires 'MARC::File::XML', '1.0.5';
 requires 'MARC::File::MARCMaker', '0.05';
 requires 'MARC::File::MiJ' , '0.04';
 requires 'MARC::Record', '2.0.6';

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 141/208: 1.12

2017-10-27 Thread Jonas Smedegaard
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 5f06ef6df50a2fc9943e58ca44e227aee6c8f0fe
Author: Patrick Hochstenbach 
Date:   Mon May 29 10:23:50 2017 +0200

1.12
---
 Build.PL | 4 ++--
 Changes  | 2 ++
 lib/Catmandu/Exporter/MARC.pm| 2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/Base.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm| 2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Exporter/MARC/XML.pm| 2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   | 2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  | 2 +-
 lib/Catmandu/Fix/marc_add.pm | 2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm | 2 +-
 lib/Catmandu/Fix/marc_in_json.pm | 2 +-
 lib/Catmandu/Fix/marc_map.pm | 2 +-
 lib/Catmandu/Fix/marc_remove.pm  | 2 +-
 lib/Catmandu/Fix/marc_set.pm | 2 +-
 lib/Catmandu/Fix/marc_spec.pm| 2 +-
 lib/Catmandu/Fix/marc_xml.pm | 2 +-
 lib/Catmandu/Importer/MARC.pm| 2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm| 2 +-
 lib/Catmandu/Importer/MARC/ISO.pm| 2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   | 2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   | 2 +-
 lib/Catmandu/Importer/MARC/RAW.pm| 2 +-
 lib/Catmandu/Importer/MARC/Record.pm | 2 +-
 lib/Catmandu/Importer/MARC/XML.pm| 2 +-
 lib/Catmandu/MARC.pm | 2 +-
 37 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/Build.PL b/Build.PL
index 2c1b44c..d4673e2 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;
 
@@ -18,7 +18,7 @@ my %module_build_args = (
 "Patrick Hochstenbach, C<<  >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.11",
+  "dist_version" => "1.12",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index e6b2483..2e172de 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+
+1.12  2017-05-29 10:23:23 CEST
   - Fixing missing space to caret translation in 008 fields for ALEPHSEQ 
exports
   - Upgrading to latest MARC::File::XML
   - Providing documenation on the MARC-in-JSON format
diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index d48fc71..1c08f86 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -2,7 +2,7 @@ package Catmandu::Exporter::MARC;
 use Catmandu::Sane;
 use Moo;
 
-our $VERSION = '1.11';
+our $VERSION = '1.12';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
 has _exporter  => (is => 'ro' , lazy => 1 , builder => '_build_exporter' , 
handles => 'Catmandu::Exporter');
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index e6dacec..0c6a67b 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -58,7 +58,7 @@ use Catmandu::Util qw(xml_escape is_different :array :is);
 use List::Util;
 use Moo;
 
-our $VERSION = '1.11';
+our $VERSION = '1.12';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/Base.pm 
b/lib/Catmandu/Exporter/MARC/Base.pm
index a0aa807..4c80888 100644
--- a/lib/Catmandu/Exporter/MARC/Base.pm
+++ b/lib/Catmandu/Exporter/MARC/Base.pm
@@ -3,7 +3,7 @@ use Moo::Role;
 use MARC::Record;
 use MARC::Field;
 
-our $VERSION = '1.11';
+our $VERSION = '1.12';
 
 sub _raw_to_marc_record {
 my ($self,$data) = @_;
diff --git a/lib/Catmandu/Exporter/MARC/ISO.pm 
b/lib/Catmandu/Exporter/MARC/ISO.pm
index c7b6c93..d845c33 100644
--- a/lib/Catmandu/Exporter/MARC/ISO.pm
+++ b/lib/Catmandu/Exporter/MARC/ISO.pm
@@ -60,7 +60,7 @@ use MARC::Record;
 use MARC::Field;
 use 

[libcatmandu-marc-perl] 152/208: 1.13

2017-10-27 Thread Jonas Smedegaard
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 4f32eea9a05614e40ef6089457c28719a84f9ed8
Author: Patrick Hochstenbach 
Date:   Thu Jun 15 09:19:38 2017 +0200

1.13
---
 Build.PL | 2 +-
 Changes  | 2 ++
 lib/Catmandu/Exporter/MARC.pm| 2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/Base.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm| 2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Exporter/MARC/XML.pm| 2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   | 2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  | 2 +-
 lib/Catmandu/Fix/marc_add.pm | 2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm | 2 +-
 lib/Catmandu/Fix/marc_in_json.pm | 2 +-
 lib/Catmandu/Fix/marc_map.pm | 2 +-
 lib/Catmandu/Fix/marc_remove.pm  | 2 +-
 lib/Catmandu/Fix/marc_set.pm | 2 +-
 lib/Catmandu/Fix/marc_spec.pm| 2 +-
 lib/Catmandu/Fix/marc_xml.pm | 2 +-
 lib/Catmandu/Importer/MARC.pm| 2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm| 2 +-
 lib/Catmandu/Importer/MARC/ISO.pm| 2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   | 2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   | 2 +-
 lib/Catmandu/Importer/MARC/RAW.pm| 2 +-
 lib/Catmandu/Importer/MARC/Record.pm | 2 +-
 lib/Catmandu/Importer/MARC/XML.pm| 2 +-
 lib/Catmandu/MARC.pm | 2 +-
 37 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/Build.PL b/Build.PL
index d4673e2..5b53e5f 100644
--- a/Build.PL
+++ b/Build.PL
@@ -18,7 +18,7 @@ my %module_build_args = (
 "Patrick Hochstenbach, C<<  >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.12",
+  "dist_version" => "1.13",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index ca7f923..4b1f008 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+
+1.13  2017-06-15 09:19:13 CEST
   - Fixing join subfields per field correctly in marc_spec
 
 1.12  2017-05-29 10:23:23 CEST
diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index 1c08f86..48d8f1c 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -2,7 +2,7 @@ package Catmandu::Exporter::MARC;
 use Catmandu::Sane;
 use Moo;
 
-our $VERSION = '1.12';
+our $VERSION = '1.13';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
 has _exporter  => (is => 'ro' , lazy => 1 , builder => '_build_exporter' , 
handles => 'Catmandu::Exporter');
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index 0c6a67b..d1f9d5d 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -58,7 +58,7 @@ use Catmandu::Util qw(xml_escape is_different :array :is);
 use List::Util;
 use Moo;
 
-our $VERSION = '1.12';
+our $VERSION = '1.13';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/Base.pm 
b/lib/Catmandu/Exporter/MARC/Base.pm
index 4c80888..63cfdc3 100644
--- a/lib/Catmandu/Exporter/MARC/Base.pm
+++ b/lib/Catmandu/Exporter/MARC/Base.pm
@@ -3,7 +3,7 @@ use Moo::Role;
 use MARC::Record;
 use MARC::Field;
 
-our $VERSION = '1.12';
+our $VERSION = '1.13';
 
 sub _raw_to_marc_record {
 my ($self,$data) = @_;
diff --git a/lib/Catmandu/Exporter/MARC/ISO.pm 
b/lib/Catmandu/Exporter/MARC/ISO.pm
index d845c33..c376f7a 100644
--- a/lib/Catmandu/Exporter/MARC/ISO.pm
+++ b/lib/Catmandu/Exporter/MARC/ISO.pm
@@ -60,7 +60,7 @@ use MARC::Record;
 use MARC::Field;
 use MARC::File::USMARC;
 
-our $VERSION = '1.12';
+our $VERSION = '1.13';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/MARCMaker.pm 
b/lib/Catmandu/Exporter/MARC/MARCMaker.pm
index fd5432b..71baed9 100644
--- a/lib/Catmandu/Exporter/MARC/MARCMaker.pm
+++ 

[libcatmandu-marc-perl] 144/208: Merge branch 'dev' into mapping_rules_spec

2017-10-27 Thread Jonas Smedegaard
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 33c91be38c8e3e7eae8a16b19c03ad3c43d1a829
Merge: 6f22b59 6233c59
Author: Carsten Klee 
Date:   Mon May 29 12:26:47 2017 +0200

Merge branch 'dev' into mapping_rules_spec

 Build.PL |  4 +-
 Changes  |  7 ++-
 LICENSE-bu_bibs.txt  |  2 +-
 lib/Catmandu/Exporter/MARC.pm|  2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 15 ---
 lib/Catmandu/Exporter/MARC/Base.pm   |  2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm|  2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  |  2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 57 +++-
 lib/Catmandu/Exporter/MARC/XML.pm|  2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   |  2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   |  2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  |  2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm |  2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  |  2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  |  2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   |  2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  |  2 +-
 lib/Catmandu/Fix/marc_add.pm |  2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm |  2 +-
 lib/Catmandu/Fix/marc_in_json.pm |  2 +-
 lib/Catmandu/Fix/marc_map.pm |  2 +-
 lib/Catmandu/Fix/marc_remove.pm  |  2 +-
 lib/Catmandu/Fix/marc_set.pm |  2 +-
 lib/Catmandu/Fix/marc_spec.pm|  2 +-
 lib/Catmandu/Fix/marc_xml.pm |  2 +-
 lib/Catmandu/Importer/MARC.pm|  2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   |  2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm|  2 +-
 lib/Catmandu/Importer/MARC/ISO.pm|  2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   |  2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  |  2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm|  2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   |  2 +-
 lib/Catmandu/Importer/MARC/RAW.pm|  2 +-
 lib/Catmandu/Importer/MARC/Record.pm |  2 +-
 lib/Catmandu/Importer/MARC/XML.pm|  2 +-
 lib/Catmandu/MARC.pm |  2 +-
 38 files changed, 108 insertions(+), 43 deletions(-)


-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 138/208: Fixing spaces -> caret translation in Aleph sequential exports

2017-10-27 Thread Jonas Smedegaard
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 443c9fa4d9e2a07c978e781b3245beb1f43e630e
Author: Patrick Hochstenbach 
Date:   Mon May 29 10:10:27 2017 +0200

Fixing spaces -> caret translation in Aleph sequential exports
---
 Build.PL   |  2 +-
 cpanfile   |  2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm | 13 +
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Build.PL b/Build.PL
index 17b2204..2e0d980 100644
--- a/Build.PL
+++ b/Build.PL
@@ -29,7 +29,7 @@ my %module_build_args = (
 "List::Util" => 0,
 "MARC::File::MARCMaker" => "0.05",
 "MARC::File::MiJ" => "0.04",
-"MARC::File::XML" => "v1.0.3",
+"MARC::File::XML" => "v1.0.5",
 "MARC::Lint" => 0,
 "MARC::Parser::RAW" => 0,
 "MARC::Record" => "v2.0.6",
diff --git a/cpanfile b/cpanfile
index aaf401f..44fde68 100644
--- a/cpanfile
+++ b/cpanfile
@@ -15,7 +15,7 @@ requires 'Catmandu', '>=1.0201';
 requires 'JSON::XS', '2.3';
 requires 'YAML::XS', '0.34';
 requires 'List::Util', '0';
-requires 'MARC::File::XML', '1.0.3';
+requires 'MARC::File::XML', '1.0.5';
 requires 'MARC::File::MARCMaker', '0.05';
 requires 'MARC::File::MiJ' , '0.04';
 requires 'MARC::Record', '2.0.6';
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index a31a2e4..e6dacec 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -89,14 +89,19 @@ sub add {
 next if $#data == -1;
 
 # Joins are faster than perl string concatenation
-if (index($tag,'FMT') == 0 || index($tag,'00') == 0) {
-push @lines , join('', $_id , ' ' , $tag , $ind1 , $ind2 , ' L ', 
$data[1] );
-}
-elsif (index($tag,'LDR') == 0) {
+if (index($tag,'LDR') == 0) {
 my $ldr = $data[1];
 $ldr =~ s/ /^/og;
 push @lines , join('', $_id , ' ' , $tag , $ind1 , $ind2 , ' L ', 
$ldr );
 }
+elsif (index($tag,'008') == 0) {
+my $f008 = $data[1];
+$f008 =~ s/ /^/og;
+push @lines , join('', $_id , ' ' , $tag , $ind1 , $ind2 , ' L ', 
$f008 );
+}
+elsif (index($tag,'FMT') == 0 || index($tag,'00') == 0) {
+push @lines , join('', $_id , ' ' , $tag , $ind1 , $ind2 , ' L ', 
$data[1] );
+}
 else {
  my @line = ('', $_id , ' ' , $tag , $ind1 , $ind2 , ' L ');
  while (@data) {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 142/208: Fixing typo in the Alma name

2017-10-27 Thread Jonas Smedegaard
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 6233c598e87fd6110cfd8b8e76f04576ccdbede0
Author: Patrick Hochstenbach 
Date:   Mon May 29 10:25:35 2017 +0200

Fixing typo in the Alma name
---
 LICENSE-bu_bibs.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/LICENSE-bu_bibs.txt b/LICENSE-bu_bibs.txt
index 690fd10..734f633 100644
--- a/LICENSE-bu_bibs.txt
+++ b/LICENSE-bu_bibs.txt
@@ -1,4 +1,4 @@
-The file t/bu_bibs.mrc exported from an Akma system was provided by Boston 
University Library with a CC-BY license. The license text follows below:
+The file t/bu_bibs.mrc exported from an Alma system was provided by Boston 
University Library with a CC-BY license. The license text follows below:
 
 Attribution 4.0 International
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 145/208: new mapping rules tests

2017-10-27 Thread Jonas Smedegaard
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 03027e3d92765183ed710ecf61ac36cd496b6fbc
Author: Carsten Klee 
Date:   Tue Jun 13 13:35:43 2017 +0200

new mapping rules tests
---
 t/23-mapping_rules_spec.t | 65 +--
 1 file changed, 51 insertions(+), 14 deletions(-)

diff --git a/t/23-mapping_rules_spec.t b/t/23-mapping_rules_spec.t
index a01c01a..68e3f40 100644
--- a/t/23-mapping_rules_spec.t
+++ b/t/23-mapping_rules_spec.t
@@ -19,12 +19,15 @@ my $mrc = <<'MRC';
 
 
 Alpha
+a
 
 
 Beta
+b
 
 
 Gamma
+c
 
 
 X
@@ -376,7 +379,7 @@ note
 
 note "
 ---
-".'marc_spec(650,subject)   subject: "AlphaBetaGamma"';
+".'marc_spec(650,subject)   subject: "AlphaaBetabGammac"';
 {
 my $importer = Catmandu->importer(
 'MARC',
@@ -385,7 +388,7 @@ note "
 fix  => 'marc_spec(650,subject); retain_field(subject)'
 );
 my $record = $importer->first;
-is_deeply $record->{subject}, 'AlphaBetaGamma', 'marc_spec(650,subject)';
+is_deeply $record->{subject}, 'AlphaaBetabGammac', 
'marc_spec(650,subject)';
 }
 
 note "
@@ -458,8 +461,9 @@ note "
 is_deeply $record->{subject}, [ 'Alpha', 'Beta', 'Gamma' ], 
'marc_spec(650$a,subject.$append)';
 }
 
-note
-'marc_spec(650$a,subject, split:1) subject: [ "Alpha", "Beta" , 
"Gamma" ]';
+note "
+---
+".'marc_spec(650$a,subject, split:1) subject: [ "Alpha", "Beta" , "Gamma" 
]';
 {
 my $importer = Catmandu->importer(
 'MARC',
@@ -471,8 +475,9 @@ note
 is_deeply $record->{subject}, [ 'Alpha', 'Beta', 'Gamma' ], 
'marc_spec(650$a,subject, split:1)';
 }
 
-note
-'marc_spec(650$a,subject.$append, split:1) subject: [[ "Alpha" , 
"Beta" , "Gamma" ]]';
+note "
+---
+".'marc_spec(650$a,subject.$append, split:1) subject: [[ "Alpha" , "Beta" 
, "Gamma" ]]';
 {
 my $importer = Catmandu->importer(
 'MARC',
@@ -485,22 +490,54 @@ note
 is_deeply $record->{subject}, [ [ 'Alpha', 'Beta', 'Gamma' ] ], 
'marc_spec(650$a,subject.$append, split:1) ';
 }
 
-note
-'marc_spec(650,subject, nested_arrays:1)subject: [["Alpha"], ["Beta"] 
, ["Gamma"]]';
+note "
+---
+".'marc_spec(650,subject, nested_arrays:1)subject: [["Alpha", "a"], 
["Beta", "b"] , ["Gamma", "c"]]';
 {
 my $importer = Catmandu->importer(
 'MARC',
 file => \$mrc,
 type => 'XML',
 fix =>
-'marc_spec(650,subject, split:1, nested_arrays:1); 
retain_field(subject)'
+'marc_spec(650,subject, nested_arrays:1); retain_field(subject)'
 );
 my $record = $importer->first;
-is_deeply $record->{subject}, [ ['Alpha'], ['Beta'], ['Gamma'] ], 
'marc_spec(650,subject, nested_arrays:1)';
+is_deeply $record->{subject}, [ ['Alpha', 'a'], ['Beta', 'b'], ['Gamma', 
'c'] ], 'marc_spec(650,subject, nested_arrays:1)';
 }
 
-note
-'marc_spec(650$a,subject, split:1, nested_arrays:1)subject: 
[["Alpha"], ["Beta"] , ["Gamma"]]';
+note "
+---
+".'marc_spec(650$a$b,subject, nested_arrays:1)subject: [["Alpha", "a"], 
["Beta", "b"] , ["Gamma", "c"]]';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix =>
+'marc_spec(650$a$b,subject, nested_arrays:1); 
retain_field(subject)'
+);
+my $record = $importer->first;
+is_deeply $record->{subject}, [ ['Alpha', 'a'], ['Beta', 'b'], ['Gamma', 
'c'] ], 'marc_spec(650,subject, nested_arrays:1)';
+}
+
+note "
+---
+".'marc_spec(650$a$b,subject.$append, nested_arrays:1)subject: [[["Alpha", 
"a"], ["Beta", "b"] , ["Gamma", "c"]]]';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix =>
+'marc_spec(650$a$b, subject.$append, nested_arrays:1); 
retain_field(subject)'
+);
+my $record = $importer->first;
+is_deeply $record->{subject}, [ [ ['Alpha', 'a'], ['Beta', 'b'], ['Gamma', 
'c'] ] ], 'marc_spec(650$a$b,subject.$append, nested_arrays:1)';
+}
+
+note "
+---
+".'marc_spec(650$a,subject, split:1, nested_arrays:1)subject: [["Alpha"], 
["Beta"] , ["Gamma"]]';
 {
 my $importer = Catmandu->importer(
 'MARC',
@@ -727,7 +764,7 @@ note "
 
 note "
 ---
-".'marc_spec(..., all.$append)all: [ "Title / Name", "ABCD", "Alpha", 
"Beta", "Gamma", "XY", "Z" ]';
+".'marc_spec(..., all.$append)all: [ "Title / Name", "ABCD", "Alphaa", 
"Betab", "Gammac", "XY", "Z" ]';
 {
 my $importer = Catmandu->importer(
 'MARC',
@@ -736,7 +773,7 @@ note "
 fix  => 'marc_spec(..., all.$append); retain_field(all)'
 );
 my $record = $importer->first;
-is_deeply $record->{all}, [ "", "Title / 

[libcatmandu-marc-perl] 149/208: Fixing semicolons

2017-10-27 Thread Jonas Smedegaard
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 94386253ffef84928f51cd9b827f9529e755fd6e
Author: Patrick Hochstenbach 
Date:   Thu Jun 15 09:00:12 2017 +0200

Fixing semicolons
---
 Changes  |   1 +
 lib/Catmandu/MARC.pm | 124 ++-
 2 files changed, 64 insertions(+), 61 deletions(-)

diff --git a/Changes b/Changes
index 2e172de..d14bada 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+  - Fixing join subfields per field correctly in marc_spec
 
 1.12  2017-05-29 10:23:23 CEST
   - Fixing missing space to caret translation in 008 fields for ALEPHSEQ 
exports
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 75f63aa..e6ab9c7 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -381,11 +381,11 @@ sub marc_spec {
 my ( $indicator1, $indicator2 );
 if ( $field_spec->has_indicator1 ) {
 $indicator1 = $field_spec->indicator1;
-$indicator1= qr/$indicator1/
+$indicator1 = qr/$indicator1/;
 }
if ( $field_spec->has_indicator2 ) {
 $indicator2 = $field_spec->indicator2;
-$indicator2= qr/$indicator2/
+$indicator2 = qr/$indicator2/;
}
 
 # calculate char start
@@ -395,9 +395,9 @@ sub marc_spec {
 if ( $sp->has_char_start ) {
 $char_start = ( '#' eq $sp->char_start )
   ? $sp->char_length * -1
-  : $sp->char_start
+  : $sp->char_start;
 }
-return $char_start
+return $char_start;
 };
 
 # vars we need only for subfields
@@ -406,7 +406,7 @@ sub marc_spec {
 # set the order of subfields
 @sf_spec = map { $_ } @{ $ms->subfields };
 unless ( $pluck ) {
-@sf_spec = sort { $a->code cmp $b->code } @sf_spec
+@sf_spec = sort { $a->code cmp $b->code } @sf_spec;
 }
 
 # set invert level default
@@ -414,20 +414,20 @@ sub marc_spec {
 if ( $invert ) {
 $codes  = '[^';
 $codes .= join $EMPTY, map { $_->code } @sf_spec;
-$codes .= ']'
+$codes .= ']';
 }
 
 $invert_chars = sub {
 my ( $str, $start, $length ) = @_;
 for ( substr $str, $start, $length ) {
-$_ = $EMPTY
+$_ = $EMPTY;
 }
-return $str
+return $str;
 };
 }
 else {
 # return $value_set ASAP
-return $value_set if defined $value_set
+return $value_set if defined $value_set;
 }
 
 # vars we need for fields and subfields
@@ -440,9 +440,9 @@ sub marc_spec {
 my $to_referred = sub {
 my ( @values ) = @_;
 if($nested_arrays) {
-push @{$referred}, \@values
+push @{$referred}, \@values;
 } elsif($split) {
-push @{$referred}, @values
+push @{$referred}, @values;
 } else {
 push @{$referred}, join $join_char, @values;
 }
@@ -450,7 +450,7 @@ sub marc_spec {
 
 if(  defined $field_spec->index_start ) {
 $index_range =
-  _get_index_range( $field_spec->index_start, $field_spec->index_end, 
$#fields )
+  _get_index_range( $field_spec->index_start, $field_spec->index_end, 
$#fields );
 }
 
 # iterate over fields
@@ -464,40 +464,40 @@ sub marc_spec {
 
 # filter by indicator
 if( defined $indicator1 ) {
-next unless ( defined $field->[1] && $field->[1] =~ $indicator1)
+next unless ( defined $field->[1] && $field->[1] =~ $indicator1);
 }
 
 if( defined $indicator2 ) {
 #next unless $field->[2] =~ $indicator2;
-next unless ( defined $field->[2] && $field->[2] =~ $indicator2)
+next unless ( defined $field->[2] && $field->[2] =~ $indicator2);
 }
 
 # filter by index
 if ( defined $index_range ) {
-next unless ( Catmandu::Util::array_includes( $index_range, 
$tag_index ) )
+next unless ( Catmandu::Util::array_includes( $index_range, 
$tag_index ) );
 }
 
 # filter field by subspec
 if( $field_spec->has_subspecs) {
 my $valid = $self->_it_subspecs( $data, $field_spec->tag, 
$field_spec->subspecs, $tag_index );
-next unless $valid
+next unless $valid;
 }
-
+
 my @subfields = ();
-
+
 if ( $ms->has_subfields ) {# now we dealing with subfields
 for my $sf (@sf_spec) {
 # set invert level
 if ( $invert && !$sf->has_subspecs) {
 if ( -1 == $sf->index_length && !$sf->has_char_start ) {
 next if ( $invert_level == 3 );# skip 

[libcatmandu-marc-perl] 121/208: Fixing again the $append bug $49 now with support for $prepend, $last, $first, ....

2017-10-27 Thread Jonas Smedegaard
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 553bf8eb777567e57ca620bf141740e0b0c742a8
Author: Patrick Hochstenbach 
Date:   Mon Mar 27 11:27:29 2017 +0200

Fixing again the $append bug $49 now with support for $prepend, $last,
$first, 
---
 Changes |  1 +
 lib/Catmandu/Fix/Inline/marc_map.pm |  2 ++
 lib/Catmandu/Fix/marc_map.pm| 10 +-
 lib/Catmandu/Fix/marc_spec.pm   | 13 +++--
 lib/Catmandu/MARC.pm|  4 ++--
 t/07-inline-fix.t   |  8 +++-
 6 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/Changes b/Changes
index 3921ab0..9af4de0 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+  - Supporting forced arrays for $prepend, $append, $first, $last and any 
digits in the path
 
 1.08  2017-03-06 09:55:53 CET
   - Fixed broken $append mapping and added many more tests
diff --git a/lib/Catmandu/Fix/Inline/marc_map.pm 
b/lib/Catmandu/Fix/Inline/marc_map.pm
index 57f575c..1c18fb8 100644
--- a/lib/Catmandu/Fix/Inline/marc_map.pm
+++ b/lib/Catmandu/Fix/Inline/marc_map.pm
@@ -75,6 +75,8 @@ sub marc_map {
 $opts{'-pluck'} = 0 unless exists $opts{'-pluck'};
 $opts{'-nested_arrays'} = 1 unless exists $opts{'-nested_arrays'};
 
+$opts{'-force_array'} = 1 if (wantarray);
+
 my $vals = Catmandu::MARC->instance->marc_map(
 $data,
 $marc_path,
diff --git a/lib/Catmandu/Fix/marc_map.pm b/lib/Catmandu/Fix/marc_map.pm
index 35bae0c..d5a88de 100644
--- a/lib/Catmandu/Fix/marc_map.pm
+++ b/lib/Catmandu/Fix/marc_map.pm
@@ -28,12 +28,12 @@ sub emit {
 my $marc = $fixer->capture($marc_obj);
 my $marc_path= $fixer->capture($marc_context);
 my $marc_opt = $fixer->capture({
-'-join'   => $self->join   // '' ,
-'-split'  => $self->split  // 0 ,
-'-pluck'  => $self->pluck  // 0 ,
+'-join'  => $self->join   // '' ,
+'-split' => $self->split  // 0 ,
+'-pluck' => $self->pluck  // 0 ,
 '-nested_arrays' => $self->nested_arrays // 0 ,
-'-value'  => $self->value ,
-'-append' => $key eq '$append'
+'-value' => $self->value ,
+'-force_array'   => ($key =~ /^(\$.*|\d+)$/) ? 1 : 0
 });
 
 my $var   = $fixer->var;
diff --git a/lib/Catmandu/Fix/marc_spec.pm b/lib/Catmandu/Fix/marc_spec.pm
index 3999542..82ea7b3 100644
--- a/lib/Catmandu/Fix/marc_spec.pm
+++ b/lib/Catmandu/Fix/marc_spec.pm
@@ -28,13 +28,14 @@ sub emit {
 my $marc = $fixer->capture($marc_obj);
 my $marc_spec= $fixer->capture($spec);
 my $marc_opt = $fixer->capture({
-'-join'   => $self->join   // '' ,
-'-split'  => $self->split  // 0 ,
-'-pluck'  => $self->pluck  // 0 ,
-'-invert' => $self->invert // 0 ,
-'-value'  => $self->value ,
-'-append' => $key eq '$append'
+'-join'=> $self->join   // '' ,
+'-split'   => $self->split  // 0 ,
+'-pluck'   => $self->pluck  // 0 ,
+'-invert'  => $self->invert // 0 ,
+'-value'   => $self->value ,
+'-force_array' => ($key =~ /^(\$.*|\d+)$/) ? 1 : 0
 });
+
 my $var  = $fixer->var;
 my $result   = $fixer->generate_var;
 my $current_value = $fixer->generate_var;
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index b63f445..cc3d522 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -36,7 +36,7 @@ sub marc_map {
 my $pluck  = $_[3]->{'-pluck'} // 0;
 my $value_set  = $_[3]->{'-value'} // undef;
 my $nested_arrays  = $_[3]->{'-nested_arrays'} // 0;
-my $append = $_[3]->{'-append'} // undef;
+my $append = $_[3]->{'-force_array'} // undef;
 
 my $vals;
 
@@ -350,7 +350,7 @@ sub marc_spec {
 my $pluck  = $_[3]->{'-pluck'} // 0;
 my $value_set  = $_[3]->{'-value'} // undef;
 my $invert = $_[3]->{'-invert'} // 0;
-my $append = $_[3]->{'-append'} // undef;
+my $append = $_[3]->{'-force_array'} // undef;
 
 my $vals;
 
diff --git a/t/07-inline-fix.t b/t/07-inline-fix.t
index ff2124c..80fc702 100644
--- a/t/07-inline-fix.t

[libcatmandu-marc-perl] 119/208: Adding Boston University Library sample data

2017-10-27 Thread Jonas Smedegaard
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 7f0b3621a07334a826430b51bef3484292b85651
Author: Patrick Hochstenbach 
Date:   Wed Mar 22 10:52:20 2017 +0100

Adding Boston University Library sample data
---
 LICENSE-bu_bibs.txt | 398 
 t/bu_bibs.mrc   |   1 +
 2 files changed, 399 insertions(+)

diff --git a/LICENSE-bu_bibs.txt b/LICENSE-bu_bibs.txt
new file mode 100644
index 000..9323c5c
--- /dev/null
+++ b/LICENSE-bu_bibs.txt
@@ -0,0 +1,398 @@
+The file t/bu_bibs.mrc was provided by Boston University Library with a CC-BY 
license. The 
+license text follows below:
+
+Attribution 4.0 International
+
+===
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+ Considerations for licensors: Our public licenses are
+ intended for use by those authorized to give the public
+ permission to use material in ways otherwise restricted by
+ copyright and certain other rights. Our licenses are
+ irrevocable. Licensors should read and understand the terms
+ and conditions of the license they choose before applying it.
+ Licensors should also secure all rights necessary before
+ applying our licenses so that the public can reuse the
+ material as expected. Licensors should clearly mark any
+ material not subject to the license. This includes other CC-
+ licensed material, or material used under an exception or
+ limitation to copyright. More considerations for licensors:
+   wiki.creativecommons.org/Considerations_for_licensors
+
+ Considerations for the public: By using one of our public
+ licenses, a licensor grants the public permission to use the
+ licensed material under specified terms and conditions. If
+ the licensor's permission is not necessary for any reason--for
+ example, because of any applicable exception or limitation to
+ copyright--then that use is not regulated by the license. Our
+ licenses grant only permissions under copyright and certain
+ other rights that a licensor has authority to grant. Use of
+ the licensed material may still be restricted for other
+ reasons, including because others have copyright or other
+ rights in the material. A licensor may make special requests,
+ such as asking that all changes be marked or described.
+ Although not required by our licenses, you are encouraged to
+ respect those requests where reasonable. More_considerations
+ for the public: 
+   wiki.creativecommons.org/Considerations_for_licensees
+
+===
+
+Creative Commons Attribution 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution 4.0 International Public License ("Public License"). To the
+extent this Public License may be interpreted as a contract, You are
+granted the Licensed Rights in consideration of Your acceptance of
+these terms and conditions, and the Licensor grants You such rights in
+consideration of benefits the Licensor receives from making the
+Licensed Material available under these terms and conditions.
+
+
+Section 1 -- Definitions.
+
+  a. Adapted Material means material subject to Copyright and Similar
+ Rights that is derived from or based upon the Licensed Material
+ and in which the Licensed Material is translated, altered,
+ arranged, transformed, or otherwise modified in a manner requiring
+ permission under the Copyright and Similar Rights held by the
+ Licensor. For purposes of this Public License, where the Licensed
+ Material is a musical work, performance, or sound recording,
+ Adapted Material is always 

[libcatmandu-marc-perl] 116/208: Adding pod

2017-10-27 Thread Jonas Smedegaard
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 ff3ea0a7cfe86f29adcc93d37af335c2301f3f20
Author: Patrick Hochstenbach 
Date:   Mon Mar 6 09:52:30 2017 +0100

Adding pod
---
 lib/Catmandu/Fix/marc_map.pm |  4 
 t/22-mapping_rules.t | 12 
 2 files changed, 16 insertions(+)

diff --git a/lib/Catmandu/Fix/marc_map.pm b/lib/Catmandu/Fix/marc_map.pm
index 005f4ba..97d0317 100644
--- a/lib/Catmandu/Fix/marc_map.pm
+++ b/lib/Catmandu/Fix/marc_map.pm
@@ -147,6 +147,10 @@ The MARC_PATH can point to one or more MARC subfields. For 
instamce:
 marc_path('245a',title)
 marc_path('245ac',title)
 
+You can also use dollar signs to indicate subfields
+
+marc_path('245$a$c',title)
+
 Wildcards are allowed in the field names:
 
 # Map all the 200-fields to a title
diff --git a/t/22-mapping_rules.t b/t/22-mapping_rules.t
index 2a9c4b9..2ff7bc3 100644
--- a/t/22-mapping_rules.t
+++ b/t/22-mapping_rules.t
@@ -85,6 +85,18 @@ note 'marc_map(245ac,title)title: "Title / Name"';
 is_deeply $record->{title}, 'Title / Name', 'marc_map(245ac,title)';
 }
 
+note 'marc_map(245$a$c,title)title: "Title / Name"';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => 'marc_map(245$a$c,title); retain_field(title)'
+);
+my $record = $importer->first;
+is_deeply $record->{title}, 'Title / Name', 'marc_map(245$a$c,title)';
+}
+
 note 'marc_map(245ca,title)title: "Title / Name"';
 {
 my $importer = Catmandu->importer(

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 120/208: Edit the header of the license

2017-10-27 Thread Jonas Smedegaard
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 a83639d2ab402fcf2815821b89bc594b1da9a489
Author: Patrick Hochstenbach 
Date:   Wed Mar 22 10:53:03 2017 +0100

Edit the header of the license
---
 LICENSE-bu_bibs.txt | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/LICENSE-bu_bibs.txt b/LICENSE-bu_bibs.txt
index 9323c5c..690fd10 100644
--- a/LICENSE-bu_bibs.txt
+++ b/LICENSE-bu_bibs.txt
@@ -1,5 +1,4 @@
-The file t/bu_bibs.mrc was provided by Boston University Library with a CC-BY 
license. The 
-license text follows below:
+The file t/bu_bibs.mrc exported from an Akma system was provided by Boston 
University Library with a CC-BY license. The license text follows below:
 
 Attribution 4.0 International
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 124/208: marc_spec supports nested_arrays and subspecs

2017-10-27 Thread Jonas Smedegaard
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 87ef375df26608bb7a127f7fb62e26a34702515f
Author: Carsten Klee 
Date:   Thu Apr 6 15:01:08 2017 +0200

marc_spec supports nested_arrays and subspecs
---
 lib/Catmandu/Fix/marc_spec.pm |  16 +-
 lib/Catmandu/MARC.pm  | 497 +-
 t/21-marc-spec.t  |  93 
 t/23-mapping_rules_spec.t | 225 ---
 t/24-marc-spec-subspecs.t | 402 ++
 t/marc_spec.fix   |   3 +
 6 files changed, 957 insertions(+), 279 deletions(-)

diff --git a/lib/Catmandu/Fix/marc_spec.pm b/lib/Catmandu/Fix/marc_spec.pm
index a4a32d9..d9b2438 100644
--- a/lib/Catmandu/Fix/marc_spec.pm
+++ b/lib/Catmandu/Fix/marc_spec.pm
@@ -9,13 +9,14 @@ with 'Catmandu::Fix::Base';
 
 our $VERSION = '1.09';
 
-has spec   => ( fix_arg => 1 );
-has path   => ( fix_arg => 1 );
-has split  => ( fix_opt => 1 );
-has join   => ( fix_opt => 1 );
-has value  => ( fix_opt => 1 );
-has pluck  => ( fix_opt => 1 );
-has invert => ( fix_opt => 1 );
+has spec  => ( fix_arg=> 1 );
+has path  => ( fix_arg=> 1 );
+has split => ( fix_opt=> 1 );
+has join  => ( fix_opt=> 1 );
+has value => ( fix_opt=> 1 );
+has pluck => ( fix_opt=> 1 );
+has invert=> ( fix_opt=> 1 );
+has nested_arrays => (fix_opt => 1);
 
 sub emit {
 my ( $self, $fixer ) = @_;
@@ -31,6 +32,7 @@ sub emit {
 '-join'=> $self->join   // '' ,
 '-split'   => $self->split  // 0 ,
 '-pluck'   => $self->pluck  // 0 ,
+'-nested_arrays' => $self->nested_arrays // 0 ,
 '-invert'  => $self->invert // 0 ,
 '-value'   => $self->value ,
 '-force_array' => ($key =~ /^(\$.*|\d+)$/) ? 1 : 0
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 0d7e7d0..102eaf7 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -4,14 +4,17 @@ use Catmandu::Sane;
 use Catmandu::Util;
 use Catmandu::Exporter::MARC::XML;
 use MARC::Spec;
+use List::Util;
 use Memoize;
 use Carp;
 use Moo;
+
 with 'MooX::Singleton';
 
 memoize('compile_marc_path');
 memoize('parse_marc_spec');
-memoize('get_index_range');
+memoize('_it_subspecs');
+memoize('_get_index_range');
 
 our $VERSION = '1.09';
 
@@ -334,307 +337,395 @@ sub marc_remove {
 return $data;
 }
 
+
 sub marc_spec {
-my $self= $_[0];
+my $self  = $_[0];
+
 # $_[1] : data record
-my $data= $_[1]->{'record'};
+my $data  = $_[1];
+my $record= $data->{'record'};
 
 # $_[2] : spec
-my $ms  = ref($_[2]) ?
-$_[2] :
-$self->parse_marc_spec( $self->spec );
+my ($ms, $spec);
+if( ref $_[2] ) {
+$ms   = $_[2];
+$spec = $ms->to_string()
+} else {
+$ms   = $self->parse_marc_spec( $_[2] ); # memoized
+$spec = $_[2];
+}
 
+my $EMPTY = q{};
 # $_[3] : opts
-my $split  = $_[3]->{'-split'} // 0;
-my $join_char  = $_[3]->{'-join'}  // '';
-my $pluck  = $_[3]->{'-pluck'} // 0;
-my $value_set  = $_[3]->{'-value'} // undef;
-my $invert = $_[3]->{'-invert'} // 0;
-my $append = $_[3]->{'-force_array'} // undef;
-
-my $vals;
+my $split = $_[3]->{'-split'} // 0;
+my $join_char = $_[3]->{'-join'}  // $EMPTY;
+my $pluck = $_[3]->{'-pluck'} // 0;
+my $value_set = $_[3]->{'-value'} // undef;
+my $invert= $_[3]->{'-invert'} // 0;
+my $nested_arrays = $_[3]->{'-nested_arrays'} // 0;
+my $append= $_[3]->{'-force_array'} // 0;
+
+if($nested_arrays) {
+$split = 1
+}
 
 # filter by tag
 my @fields = ();
 my $field_spec = $ms->field;
-my $tag= $field_spec->tag;
-$tag   = qr/$tag/;
-unless ( @fields =
-grep { $_->[0] =~ /$tag/ } @{ $data } )
-{
-return $vals;
-}
-
-if (defined $field_spec->indicator1) {
-my $indicator1 = $field_spec->indicator1;
-$indicator1= qr/$indicator1/;
-unless( @fields =
-grep { defined $_->[1] && $_->[1] =~ /$indicator1/ } @fields)
-{
-return $vals;
-}
-}
-if (defined $field_spec->indicator2) {
-my $indicator2 = $field_spec->indicator2;
-$indicator2= qr/$indicator2/;
-unless( @fields =
-grep { defined $_->[2] && $_->[2] =~ /$indicator2/ } @fields)
-{
-return $vals;
-}
-}
-
-# filter by index
-if ( -1 != 

[libcatmandu-marc-perl] 109/208: Adding marc_spec rule tests

2017-10-27 Thread Jonas Smedegaard
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 1ab3778a394eab015f2bbbdea4cdcd625fba0cf3
Author: Patrick Hochstenbach 
Date:   Thu Mar 2 14:13:17 2017 +0100

Adding marc_spec rule tests
---
 t/23-mapping_rules_spec.t | 356 ++
 1 file changed, 356 insertions(+)

diff --git a/t/23-mapping_rules_spec.t b/t/23-mapping_rules_spec.t
new file mode 100644
index 000..9ce6257
--- /dev/null
+++ b/t/23-mapping_rules_spec.t
@@ -0,0 +1,356 @@
+use strict;
+use warnings;
+use Test::More;
+use Catmandu;
+
+my $mrc = <<'MRC';
+
+http://www.loc.gov/MARC21/slim;>
+
+
+Title / 
+Name
+
+
+A
+B
+C
+D
+
+
+Alpha
+
+
+Beta
+
+
+Gamma
+
+
+X
+Y
+
+
+Z
+
+
+
+MRC
+
+note 'marc_spec(245,title) title: "Title / Name"';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => 'marc_spec(245,title); retain_field(title)'
+);
+my $record = $importer->first;
+is_deeply $record->{title}, 'Title / Name', 'marc_spec(245,title)';
+}
+
+note 'marc_spec(245$a,title)title: "Title / "';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => 'marc_spec(245$a,title); retain_field(title)'
+);
+my $record = $importer->first;
+is_deeply $record->{title}, 'Title / ', 'marc_spec(245$a,title)';
+}
+
+note 'marc_spec(245,title.$append) title: [ "Title / Name" ]';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => 'marc_spec(245,title.$append); retain_field(title)'
+);
+my $record = $importer->first;
+is_deeply $record->{title}, ['Title / Name'], 
'marc_spec(245.$append,title)';
+}
+
+note 'marc_spec(245$a,title.$append)title: [ "Title / " ]';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => 'marc_spec(245$a,title.$append); retain_field(title)'
+);
+my $record = $importer->first;
+is_deeply $record->{title}, ['Title / '], 'marc_spec(245$a.$append,title)';
+}
+
+note 'marc_spec(245,title, split:1)title: [ "Title / ", "Name" ]';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => 'marc_spec(245,title, split:1); retain_field(title)'
+);
+my $record = $importer->first;
+is_deeply $record->{title}, [ 'Title / ', 'Name' ],
+'marc_spec(245,title, split:1)';
+}
+
+note
+'marc_spec(245, title, split:1, nested_arrays:1)  title: [[ "Title / ", 
"Name" ]]';
+{
+note "nested_arrays not yet supported";
+}
+
+note 'marc_spec(500,note)  note: "ABCD"';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => 'marc_spec(500,note); retain_field(note)'
+);
+my $record = $importer->first;
+is_deeply $record->{note}, 'ABCD', 'marc_spec(500,note)';
+}
+
+note 'marc_spec(500$a,note) note: "ABC"';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => 'marc_spec(500$a,note); retain_field(note)'
+);
+my $record = $importer->first;
+is_deeply $record->{note}, 'ABC', 'marc_spec(500$a,note)';
+}
+
+note 'marc_spec(500,note.$append)  note: [ "ABCD" ]';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => ' marc_spec(500,note.$append); retain_field(note)'
+);
+my $record = $importer->first;
+is_deeply $record->{note}, ['ABCD'], ' marc_spec(500,note.$append)';
+}
+
+note 'marc_spec(500$a,note.$append) note: [ "ABC" ]';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => ' marc_spec(500$a,note.$append); retain_field(note)'
+);
+my $record = $importer->first;
+is_deeply $record->{note}, ['ABC'], ' marc_spec(500$a,note.$append)';
+}
+
+note 'marc_spec(500,note, split:1) note: [ "A" , "B" , "C" , "D" ]';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file => \$mrc,
+type => 'XML',
+fix  => 'marc_spec(500,note, split:1); retain_field(note)'
+);
+my $record = $importer->first;
+is_deeply $record->{note}, [ 'A', 'B', 'C', 'D' ], 'marc_spec(500,note, 
split:1)';
+}
+
+note 'marc_spec(500$a,note, split:1)note: [ "A" , "B" , "C" ]';
+{
+my $importer = Catmandu->importer(
+'MARC',
+file 

[libcatmandu-marc-perl] 129/208: 1.10

2017-10-27 Thread Jonas Smedegaard
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 4cd86ecaba8579d53609096dfd7b7fc8670a142b
Author: Patrick Hochstenbach 
Date:   Tue May 2 11:49:01 2017 +0200

1.10
---
 Build.PL | 2 +-
 Changes  | 2 ++
 lib/Catmandu/Exporter/MARC.pm| 2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/Base.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm| 2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Exporter/MARC/XML.pm| 2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   | 2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  | 2 +-
 lib/Catmandu/Fix/marc_add.pm | 2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm | 2 +-
 lib/Catmandu/Fix/marc_in_json.pm | 2 +-
 lib/Catmandu/Fix/marc_map.pm | 2 +-
 lib/Catmandu/Fix/marc_remove.pm  | 2 +-
 lib/Catmandu/Fix/marc_set.pm | 2 +-
 lib/Catmandu/Fix/marc_spec.pm| 2 +-
 lib/Catmandu/Fix/marc_xml.pm | 2 +-
 lib/Catmandu/Importer/MARC.pm| 2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm| 2 +-
 lib/Catmandu/Importer/MARC/ISO.pm| 2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   | 2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   | 2 +-
 lib/Catmandu/Importer/MARC/RAW.pm| 2 +-
 lib/Catmandu/Importer/MARC/Record.pm | 2 +-
 lib/Catmandu/Importer/MARC/XML.pm| 2 +-
 lib/Catmandu/MARC.pm | 2 +-
 37 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/Build.PL b/Build.PL
index 9da982e..9800983 100644
--- a/Build.PL
+++ b/Build.PL
@@ -18,7 +18,7 @@ my %module_build_args = (
 "Patrick Hochstenbach, C<<  >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.09",
+  "dist_version" => "1.10",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index 41febde..3c05fed 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+
+1.10  2017-05-02 11:48:37 CEST
   - Adding support for nested_arrays and subspecs in marc_spec
   
 1.09  2017-03-27 11:29:28 CEST
diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index 9e33e82..e807379 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -2,7 +2,7 @@ package Catmandu::Exporter::MARC;
 use Catmandu::Sane;
 use Moo;
 
-our $VERSION = '1.09';
+our $VERSION = '1.10';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
 has _exporter  => (is => 'ro' , lazy => 1 , builder => '_build_exporter' , 
handles => 'Catmandu::Exporter');
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index aacf0ed..f98d39a 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -58,7 +58,7 @@ use Catmandu::Util qw(xml_escape is_different :array :is);
 use List::Util;
 use Moo;
 
-our $VERSION = '1.09';
+our $VERSION = '1.10';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/Base.pm 
b/lib/Catmandu/Exporter/MARC/Base.pm
index 0944d90..1c7375a 100644
--- a/lib/Catmandu/Exporter/MARC/Base.pm
+++ b/lib/Catmandu/Exporter/MARC/Base.pm
@@ -3,7 +3,7 @@ use Moo::Role;
 use MARC::Record;
 use MARC::Field;
 
-our $VERSION = '1.09';
+our $VERSION = '1.10';
 
 sub _raw_to_marc_record {
 my ($self,$data) = @_;
diff --git a/lib/Catmandu/Exporter/MARC/ISO.pm 
b/lib/Catmandu/Exporter/MARC/ISO.pm
index 5707323..cce595e 100644
--- a/lib/Catmandu/Exporter/MARC/ISO.pm
+++ b/lib/Catmandu/Exporter/MARC/ISO.pm
@@ -60,7 +60,7 @@ use MARC::Record;
 use MARC::Field;
 use MARC::File::USMARC;
 
-our $VERSION = '1.09';
+our $VERSION = '1.10';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/MARCMaker.pm 
b/lib/Catmandu/Exporter/MARC/MARCMaker.pm
index b16cd1b..c88338f 100644
--- a/lib/Catmandu/Exporter/MARC/MARCMaker.pm
+++ 

[libcatmandu-marc-perl] 128/208: Version up

2017-10-27 Thread Jonas Smedegaard
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 c735c950ba1653cbdd8d96fca7c3c6c783014f9d
Author: Patrick Hochstenbach 
Date:   Tue May 2 11:47:33 2017 +0200

Version up
---
 Build.PL | 3 +--
 Changes  | 3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Build.PL b/Build.PL
index 9b35045..9da982e 100644
--- a/Build.PL
+++ b/Build.PL
@@ -25,7 +25,6 @@ my %module_build_args = (
   "requires" => {
 "Carp" => 0,
 "Catmandu" => "1.0201",
-"Const::Fast" => "0.014",
 "JSON::XS" => "2.3",
 "List::Util" => 0,
 "MARC::File::MARCMaker" => "0.05",
@@ -34,7 +33,7 @@ my %module_build_args = (
 "MARC::Lint" => 0,
 "MARC::Parser::RAW" => 0,
 "MARC::Record" => "v2.0.6",
-"MARC::Spec" => "v0.1.1",
+"MARC::Spec" => "v0.1.4",
 "Memoize" => 0,
 "Moo" => "1.0",
 "MooX::Singleton" => 0,
diff --git a/Changes b/Changes
index ca5c83c..41febde 100644
--- a/Changes
+++ b/Changes
@@ -1,7 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
-
+  - Adding support for nested_arrays and subspecs in marc_spec
+  
 1.09  2017-03-27 11:29:28 CEST
   - Supporting forced arrays for $prepend, $append, $first, $last and any 
digits in the path
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 111/208: Adding more tests

2017-10-27 Thread Jonas Smedegaard
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 7564f1f56d0cdc848573f6df9d217ee2ce19574c
Author: Patrick Hochstenbach 
Date:   Thu Mar 2 14:48:25 2017 +0100

Adding more tests
---
 t/07-inline-fix.t | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/t/07-inline-fix.t b/t/07-inline-fix.t
index b36287f..ff2124c 100644
--- a/t/07-inline-fix.t
+++ b/t/07-inline-fix.t
@@ -101,4 +101,27 @@ ok(@$records == 2 , "Found 2 records");
ok @arr == 2;
 }
 
+{
+   my @arr = marc_map($records->[1],'300bxa', -split=>1 , -pluck=>1);
+
+is_deeply \@arr , [[
+ 'ill. ;' ,
+ undef ,
+ 'xxi, 289 p. :',
+]] , 'marc_map(300bxa, split:1 , pluck: 1)';
+}
+
+{
+   my @arr = marc_map($records->[1],'630xa', -split=>1 , -pluck=>1);
+
+is_deeply \@arr , [
+ [ undef ,
+   'Active server pages.',
+ ] ,
+ [ undef,
+   'ActiveX.'
+ ] ,
+] , 'marc_map(630xa, split:1 , pluck:1)';
+}
+
 done_testing;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 130/208: check definition of vals with option split

2017-10-27 Thread Jonas Smedegaard
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 d34a500d3857511cb9a9357bee163bcf71de089a
Author: Carsten Klee 
Date:   Fri May 12 11:52:45 2017 +0200

check definition of vals with option split
---
 lib/Catmandu/MARC.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 20d07d6..09b062b 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -143,7 +143,7 @@ sub marc_map {
 }
 }
 
-if ($split) {
+if ($split and defined $vals) {
 $vals = [ $vals ];
 }
 elsif ($append) {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 122/208: 1.09

2017-10-27 Thread Jonas Smedegaard
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 a1cf140fff1842aaf1c0d6e6240fe382928e3067
Author: Patrick Hochstenbach 
Date:   Mon Mar 27 11:29:51 2017 +0200

1.09
---
 Build.PL | 2 +-
 Changes  | 2 ++
 lib/Catmandu/Exporter/MARC.pm| 2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/Base.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm| 2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Exporter/MARC/XML.pm| 2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   | 2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  | 2 +-
 lib/Catmandu/Fix/marc_add.pm | 2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm | 2 +-
 lib/Catmandu/Fix/marc_in_json.pm | 2 +-
 lib/Catmandu/Fix/marc_map.pm | 2 +-
 lib/Catmandu/Fix/marc_remove.pm  | 2 +-
 lib/Catmandu/Fix/marc_set.pm | 2 +-
 lib/Catmandu/Fix/marc_spec.pm| 2 +-
 lib/Catmandu/Fix/marc_xml.pm | 2 +-
 lib/Catmandu/Importer/MARC.pm| 2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm| 2 +-
 lib/Catmandu/Importer/MARC/ISO.pm| 2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   | 2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   | 2 +-
 lib/Catmandu/Importer/MARC/RAW.pm| 2 +-
 lib/Catmandu/Importer/MARC/Record.pm | 2 +-
 lib/Catmandu/Importer/MARC/XML.pm| 2 +-
 lib/Catmandu/MARC.pm | 2 +-
 37 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/Build.PL b/Build.PL
index e09820f..9b35045 100644
--- a/Build.PL
+++ b/Build.PL
@@ -18,7 +18,7 @@ my %module_build_args = (
 "Patrick Hochstenbach, C<<  >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.08",
+  "dist_version" => "1.09",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index 9af4de0..ca5c83c 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+
+1.09  2017-03-27 11:29:28 CEST
   - Supporting forced arrays for $prepend, $append, $first, $last and any 
digits in the path
 
 1.08  2017-03-06 09:55:53 CET
diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index f190b58..9e33e82 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -2,7 +2,7 @@ package Catmandu::Exporter::MARC;
 use Catmandu::Sane;
 use Moo;
 
-our $VERSION = '1.08';
+our $VERSION = '1.09';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
 has _exporter  => (is => 'ro' , lazy => 1 , builder => '_build_exporter' , 
handles => 'Catmandu::Exporter');
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index 5a0d931..aacf0ed 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -58,7 +58,7 @@ use Catmandu::Util qw(xml_escape is_different :array :is);
 use List::Util;
 use Moo;
 
-our $VERSION = '1.08';
+our $VERSION = '1.09';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/Base.pm 
b/lib/Catmandu/Exporter/MARC/Base.pm
index 0db14b3..0944d90 100644
--- a/lib/Catmandu/Exporter/MARC/Base.pm
+++ b/lib/Catmandu/Exporter/MARC/Base.pm
@@ -3,7 +3,7 @@ use Moo::Role;
 use MARC::Record;
 use MARC::Field;
 
-our $VERSION = '1.08';
+our $VERSION = '1.09';
 
 sub _raw_to_marc_record {
 my ($self,$data) = @_;
diff --git a/lib/Catmandu/Exporter/MARC/ISO.pm 
b/lib/Catmandu/Exporter/MARC/ISO.pm
index 8d354ed..5707323 100644
--- a/lib/Catmandu/Exporter/MARC/ISO.pm
+++ b/lib/Catmandu/Exporter/MARC/ISO.pm
@@ -60,7 +60,7 @@ use MARC::Record;
 use MARC::Field;
 use MARC::File::USMARC;
 
-our $VERSION = '1.08';
+our $VERSION = '1.09';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/MARCMaker.pm 
b/lib/Catmandu/Exporter/MARC/MARCMaker.pm
index 99647a1..b16cd1b 100644
--- 

[libcatmandu-marc-perl] 135/208: Version up

2017-10-27 Thread Jonas Smedegaard
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 456bca16cd0ac648db2ec92a6a548e1ccf47
Author: Patrick Hochstenbach 
Date:   Mon May 15 09:11:07 2017 +0200

Version up
---
 Build.PL | 2 +-
 Changes  | 7 +--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Build.PL b/Build.PL
index 9800983..e424880 100644
--- a/Build.PL
+++ b/Build.PL
@@ -33,7 +33,7 @@ my %module_build_args = (
 "MARC::Lint" => 0,
 "MARC::Parser::RAW" => 0,
 "MARC::Record" => "v2.0.6",
-"MARC::Spec" => "v0.1.4",
+"MARC::Spec" => "v1.0.0",
 "Memoize" => 0,
 "Moo" => "1.0",
 "MooX::Singleton" => 0,
diff --git a/Changes b/Changes
index 3c05fed..0437818 100644
--- a/Changes
+++ b/Changes
@@ -1,10 +1,13 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
-
+  - Upgrading to MARC::Spec 1.0.0
+  - Fixing MARCspec Parser exception
+  - Fixing undef values when using $append and split
+  
 1.10  2017-05-02 11:48:37 CEST
   - Adding support for nested_arrays and subspecs in marc_spec
-  
+
 1.09  2017-03-27 11:29:28 CEST
   - Supporting forced arrays for $prepend, $append, $first, $last and any 
digits in the path
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 114/208: Merge branch 'cKlee-broken-append' into broken-append

2017-10-27 Thread Jonas Smedegaard
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 1394c2074d2375aaafeac0366cea2e07747849c6
Merge: 7564f1f 4e79126
Author: Patrick Hochstenbach 
Date:   Mon Mar 6 09:23:51 2017 +0100

Merge branch 'cKlee-broken-append' into broken-append

 lib/Catmandu/MARC.pm  |   4 +-
 t/23-mapping_rules_spec.t | 170 ++
 2 files changed, 172 insertions(+), 2 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 123/208: removed Const::Fast from cpanfile

2017-10-27 Thread Jonas Smedegaard
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 bcc94ecc7cd8fb6da9f75b56ea8d4112b9b27d9f
Author: Carsten Klee 
Date:   Thu Apr 6 14:59:43 2017 +0200

removed Const::Fast from cpanfile
---
 cpanfile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/cpanfile b/cpanfile
index 3edb3e5..4ed95c0 100644
--- a/cpanfile
+++ b/cpanfile
@@ -21,8 +21,7 @@ requires 'MARC::File::MiJ' , '0.04';
 requires 'MARC::Record', '2.0.6';
 requires 'MARC::Lint', '0';
 requires 'MARC::Parser::RAW', '0';
-requires 'Const::Fast', '0.014';
-requires 'MARC::Spec', '0.1.1';
+requires 'MARC::Spec', '0.1.4';
 requires 'Memoize', '0';
 requires 'Moo', '1.0';
 requires 'MooX::Singleton', '0';

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 25/208: Making some performance improvements

2017-10-27 Thread Jonas Smedegaard
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 50c557b0cccd642f137ed9b326de12e6d14f4912
Author: Patrick Hochstenbach 
Date:   Wed Jul 6 15:22:50 2016 +0200

Making some performance improvements
---
 .gitignore   |   4 +-
 lib/Catmandu/MARC.pm | 165 ++-
 t/bench.pl   |  14 +
 3 files changed, 115 insertions(+), 68 deletions(-)

diff --git a/.gitignore b/.gitignore
index 1c67a5a..50df8e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,4 +13,6 @@ Catmandu-MARC-*
 data
 local
 cpanfile.snapshot
-.perl-version
\ No newline at end of file
+.perl-version
+nytprof.out
+nytprof/
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 3d203f8..f951e4d 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -3,8 +3,11 @@ package Catmandu::MARC;
 use Catmandu::Sane;
 use Catmandu::Util;
 use Catmandu::Exporter::MARC::XML;
+use Memoize;
 use Carp;
 
+memoize('_compile_marc_path');
+
 our $VERSION = '0.219';
 
 sub marc_map {
@@ -28,28 +31,29 @@ sub marc_map {
 my $vals;
 
 marc_at_field($record, $marc_path, sub {
-my ($field, %context) = @_;
+my ($field, $context) = @_;
 my $v;
 
 if ($value_set) {
-for (my $i = $context{start}; $i < $context{end}; $i += 2) {
-if ($field->[$i] =~ /$context{subfield}/) {
+for (my $i = $context->{start}; $i < $context->{end}; $i += 2) {
+my $subfield_regex = $context->{subfield_regex};
+if ($field->[$i] =~ $subfield_regex) {
 $v = $value_set;
 last;
 }
 }
 }
 else {
-$v = _extract_subfields($field,\%context, pluck => $pluck);
+$v = _extract_subfields($field,$context, pluck => $pluck);
 
 if (defined $v && @$v) {
 if (!$split) {
 $v = join $join_char, @$v;
 }
 
-if (defined(my $off = $context{from})) {
+if (defined(my $off = $context->{from})) {
 $v = join $join_char, @$v if (ref $v eq 'ARRAY');
-my $len = $context{len};
+my $len = $context->{len};
 if (length(${v}) > $off) {
 $v = substr($v, $off, $len);
 } else {
@@ -110,8 +114,8 @@ sub _extract_subfields {
 }
 else {
 for (my $i = $context->{start}; $i < $context->{end}; $i += 2) {
-my $subfield = $context->{subfield};
-if ($field->[$i] =~ /^$subfield$/) {
+my $subfield_regex = $context->{subfield_regex};
+if ($field->[$i] =~ $subfield_regex) {
 push(@v, $field->[$i + 1]);
 }
 }
@@ -195,13 +199,13 @@ sub marc_set {
 }
 
 marc_at_field($record, $marc_path, sub {
-my ($field,%context) = @_;
+my ($field,$context) = @_;
 
 my $found = 0;
-for (my $i = $context{start}; $i < $context{end}; $i += 2) {
-if ($field->[$i] eq $context{subfield}) {
-if (defined $context{from}) {
-substr($field->[$i + 1], $context{from}, $context{len}) = 
$value;
+for (my $i = $context->{start}; $i < $context->{end}; $i += 2) {
+if ($field->[$i] eq $context->{subfield}) {
+if (defined $context->{from}) {
+substr($field->[$i + 1], $context->{from}, 
$context->{len}) = $value;
 }
 else {
 $field->[$i + 1] = $value;
@@ -211,7 +215,7 @@ sub marc_set {
 }
 
 if ($found == 0) {
-push(@$field,$context{subfield},$value);
+push(@$field,$context->{subfield},$value);
 }
 }, subfield_default => 1);
 
@@ -226,32 +230,36 @@ sub marc_remove {
 my $new_record;
 
 marc_at_field($record, $marc_path, sub {
-my ($field,%context) = @_;
+my ($field,$context) = @_;
 
-if ($field->[0] =~ /$context{field_regex}/) {
-if (defined $context{ind1}) {
-return if (defined $field->[1] && $field->[1] eq 
$context{ind1});
+if ($field->[0] =~ $context->{field_regex}) {
+if (defined $context->{ind1}) {
+return if (defined $field->[1] && $field->[1] eq 
$context->{ind1});
 }
 
-if (defined $context{ind2}) {
-return if (defined $field->[2] && $field->[2] eq 
$context{ind2});
+if (defined $context->{ind2}) {
+return if (defined $field->[2] && $field->[2] eq 
$context->{ind2});
 }
 
-unless (defined $context{ind1} || defined $context{ind2} || 
defined $context{subfield}) {
+unless (
+

[libcatmandu-marc-perl] 24/208: Adding benchmarking fixes

2017-10-27 Thread Jonas Smedegaard
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 aae16eff8d49832f3098bed52b3c54779734ac90
Author: Patrick Hochstenbach 
Date:   Wed Jul 6 13:28:39 2016 +0200

Adding benchmarking fixes
---
 lib/Catmandu/MARC.pm  |   60 +--
 t/bench_marc_each.fix | 1002 +
 t/bench_marc_map.fix  | 1000 
 3 files changed, 2033 insertions(+), 29 deletions(-)

diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index dc0f333..3d203f8 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -25,34 +25,6 @@ sub marc_map {
 my $value_set = $opts{'-value'};
 my $attrs = {};
 
-my $add_subfields = sub {
-my ($field,%context) = @_;
-
-my @v = ();
-
-if ($pluck) {
-# Treat the subfield as a hash index
-my $_h = {};
-for (my $i = $context{start}; $i < $context{end}; $i += 2) {
-push @{ $_h->{ $field->[$i] } } , $field->[$i + 1];
-}
-my $subfield = $context{subfield};
-$subfield =~ s{^[a-zA-Z0-9]}{}g;
-for my $c (split('',$subfield)) {
-push @v , @{ $_h->{$c} } if exists $_h->{$c};
-}
-}
-else {
-for (my $i = $context{start}; $i < $context{end}; $i += 2) {
-if ($field->[$i] =~ /^$context{subfield}$/) {
-push(@v, $field->[$i + 1]);
-}
-}
-}
-
-return @v ? \@v : undef;
-};
-
 my $vals;
 
 marc_at_field($record, $marc_path, sub {
@@ -68,7 +40,7 @@ sub marc_map {
 }
 }
 else {
-$v = $add_subfields->($field,%context);
+$v = _extract_subfields($field,\%context, pluck => $pluck);
 
 if (defined $v && @$v) {
 if (!$split) {
@@ -119,6 +91,36 @@ sub marc_map {
 }
 }
 
+sub _extract_subfields {
+my ($field,$context,%opts) = @_;
+
+my @v = ();
+
+if ($opts{pluck}) {
+# Treat the subfield as a hash index
+my $_h = {};
+for (my $i = $context->{start}; $i < $context->{end}; $i += 2) {
+push @{ $_h->{ $field->[$i] } } , $field->[$i + 1];
+}
+my $subfield = $context->{subfield};
+$subfield =~ s{^[a-zA-Z0-9]}{}g;
+for my $c (split('',$subfield)) {
+push @v , @{ $_h->{$c} } if exists $_h->{$c};
+}
+}
+else {
+for (my $i = $context->{start}; $i < $context->{end}; $i += 2) {
+my $subfield = $context->{subfield};
+if ($field->[$i] =~ /^$subfield$/) {
+push(@v, $field->[$i + 1]);
+}
+}
+}
+
+return @v ? \@v : undef;
+}
+
+
 sub marc_add {
 my ($data,$marc_path,@subfields) = @_;
 
diff --git a/t/bench_marc_each.fix b/t/bench_marc_each.fix
new file mode 100644
index 000..60c0349
--- /dev/null
+++ b/t/bench_marc_each.fix
@@ -0,0 +1,1002 @@
+do marc_each()
+marc_map('000','f000')
+marc_map('001','f001')
+marc_map('002','f002')
+marc_map('003','f003')
+marc_map('004','f004')
+marc_map('005','f005')
+marc_map('006','f006')
+marc_map('007','f007')
+marc_map('008','f008')
+marc_map('009','f009')
+marc_map('010','f010')
+marc_map('011','f011')
+marc_map('012','f012')
+marc_map('013','f013')
+marc_map('014','f014')
+marc_map('015','f015')
+marc_map('016','f016')
+marc_map('017','f017')
+marc_map('018','f018')
+marc_map('019','f019')
+marc_map('020','f020')
+marc_map('021','f021')
+marc_map('022','f022')
+marc_map('023','f023')
+marc_map('024','f024')
+marc_map('025','f025')
+marc_map('026','f026')
+marc_map('027','f027')
+marc_map('028','f028')
+marc_map('029','f029')
+marc_map('030','f030')
+marc_map('031','f031')
+marc_map('032','f032')
+marc_map('033','f033')
+marc_map('034','f034')
+marc_map('035','f035')
+marc_map('036','f036')
+marc_map('037','f037')
+marc_map('038','f038')
+marc_map('039','f039')
+marc_map('040','f040')
+marc_map('041','f041')
+marc_map('042','f042')
+marc_map('043','f043')
+marc_map('044','f044')
+marc_map('045','f045')
+marc_map('046','f046')
+marc_map('047','f047')
+marc_map('048','f048')
+marc_map('049','f049')
+marc_map('050','f050')
+marc_map('051','f051')
+marc_map('052','f052')
+marc_map('053','f053')
+marc_map('054','f054')
+marc_map('055','f055')
+marc_map('056','f056')
+marc_map('057','f057')
+marc_map('058','f058')
+marc_map('059','f059')
+marc_map('060','f060')
+marc_map('061','f061')
+marc_map('062','f062')
+marc_map('063','f063')
+marc_map('064','f064')
+

[libcatmandu-marc-perl] 117/208: New release

2017-10-27 Thread Jonas Smedegaard
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 6a0cc048fb90dab62b7aa12c9a2ff99331b65ade
Author: Patrick Hochstenbach 
Date:   Mon Mar 6 09:55:25 2017 +0100

New release
---
 Changes | 4 
 1 file changed, 4 insertions(+)

diff --git a/Changes b/Changes
index cb2dbba..05e3e0c 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,10 @@ Revision history for Catmandu-MARC
 
 {{$NEXT}}
   - Fixed broken $append mapping and added many more tests
+  - Adding a Wiki page with all mapping rules for marc_map and marc_spec
+  - Support dollar ($) to indicate subfields in marc_map
+  - Support period (.) to indicate a field wildard in marc_map
+  - Adding more tests
 
 1.07  2017-03-01 09:03:25 CET
   - A marc_map(...,...,pluck:1,split:1) will return *all* the subfields 
specified in the path (undef when they don't exist in the MARC)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 133/208: use && instead of and

2017-10-27 Thread Jonas Smedegaard
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 8da79d6c8f38065e22c77efbb91621e75c69ca67
Author: Carsten Klee 
Date:   Fri May 12 13:03:04 2017 +0200

use && instead of and
---
 lib/Catmandu/MARC.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 032e046..53300c0 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -143,7 +143,7 @@ sub marc_map {
 }
 }
 
-if ($split and defined $vals) {
+if ($split && defined $vals) {
 $vals = [ $vals ];
 }
 elsif ($append) {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 134/208: Merge branch 'cKlee-undef_vals' into dev

2017-10-27 Thread Jonas Smedegaard
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 c74be7e32e86a4bb480884a8392d8b67696c38d7
Merge: 4cd86ec 8da79d6
Author: Patrick Hochstenbach 
Date:   Mon May 15 09:08:13 2017 +0200

Merge branch 'cKlee-undef_vals' into dev

 cpanfile | 2 +-
 lib/Catmandu/MARC.pm | 6 +++---
 t/21-marc-spec.t | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 113/208: Merge branch 'broken-append' of https://github.com/cKlee/Catmandu-MARC into cKlee-broken-append

2017-10-27 Thread Jonas Smedegaard
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 4e79126506c6bd0042b6bdd796da193912c811ba
Merge: 7564f1f 99c88bb
Author: Patrick Hochstenbach 
Date:   Mon Mar 6 09:23:14 2017 +0100

Merge branch 'broken-append' of https://github.com/cKlee/Catmandu-MARC into 
cKlee-broken-append

 lib/Catmandu/MARC.pm  |   4 +-
 t/23-mapping_rules_spec.t | 170 ++
 2 files changed, 172 insertions(+), 2 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 125/208: added mrc file with only one record

2017-10-27 Thread Jonas Smedegaard
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 11d913bc9274771cc59e1c28a16114f2ca74d4a8
Author: Carsten Klee 
Date:   Thu Apr 6 15:01:49 2017 +0200

added mrc file with only one record
---
 t/camel9.mrc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/t/camel9.mrc b/t/camel9.mrc
new file mode 100644
index 000..03899ba
--- /dev/null
+++ b/t/camel9.mrc
@@ -0,0 +1 @@
+00696nam  22002538a 
45100130003000600013005001700019008004100036010001700077020002800094040001300122042000800135050002600143082001700169126001862450044002122600051002562630009003073110031652000327650003700347650001700384650004100401fol05882032
 IMchF2707091904.0000630s2000cau   001 0 eng    a   
00058174   a0764547291 (alk. paper)  aDLCcDLC  apcc00aQA76.73.P22bF64 
200000a005.13/32212 aFoster-Johnson, Eric.10aCross-platform Perl /c 
[...]
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 107/208: Fixing marc-spec

2017-10-27 Thread Jonas Smedegaard
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 21f03f5e50ea2004cf644de5cfe72a4dce525747
Author: Patrick Hochstenbach 
Date:   Thu Mar 2 13:35:16 2017 +0100

Fixing marc-spec
---
 lib/Catmandu/MARC.pm |  21 +++-
 t/21-marc-spec.t |   2 +-
 t/22-append-path.t   | 181 ---
 t/{23-mapping_rules.t => 22-mapping_rules.t} |   0
 4 files changed, 20 insertions(+), 184 deletions(-)

diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 3441e6c..2e2e517 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -436,6 +436,9 @@ sub marc_spec {
 
 for my $field (@fields) {
 my $start = 3;
+
+my @sf_results;
+
 for my $sf (@sf_spec) {
 # set invert level
 if ( $invert ) {
@@ -516,7 +519,15 @@ sub marc_spec {
   @subfield;
 }
 }
-push @subfields, @subfield if (@subfield);
+
+push @sf_results, @subfield;
+}
+
+if ($split) {
+push @subfields, @sf_results;
+}
+else {
+push @subfields, join($join_char,@sf_results);
 }
 }
 
@@ -561,7 +572,13 @@ sub marc_spec {
   map { substr $_, $char_start, $field_spec->char_length }
 @subfields;
 }
-push @mapped, @subfields;
+
+if ($split) {
+push @mapped, @subfields;
+}
+else {
+push @mapped, join($join_char,@subfields);
+}
 }
 
 unless (@mapped) {
diff --git a/t/21-marc-spec.t b/t/21-marc-spec.t
index f8fd65b..1fa3319 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);|;
diff --git a/t/22-append-path.t b/t/22-append-path.t
deleted file mode 100644
index 3a7cd76..000
--- a/t/22-append-path.t
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use warnings qw(FATAL utf8);
-use utf8;
-
-use Test::More;
-
-use Catmandu::Importer::MARC;
-use Catmandu::Fix;
-
-note("marc_map-");
-
-note("t");
-{
-my $importer = Catmandu::Importer::MARC->new( file => 't/rug01.aleph', 
type => "ALEPHSEQ" );
-my $fixer = Catmandu::Fix->new(fixes => ['marc_map(650a,t)']);
-
-my $result = $fixer->fix($importer);
-
-my $field = $result->first->{t};
-
-ok $field , 'got an 650';
-
-my $joined = join "" , (
-   'Semantics.',
-   'Proposition (Logic)',
-   'Speech acts (Linguistics)',
-   'Generative grammar.',
-   'Competence and performance (Linguistics)'
-);
-
-is $field , $joined , '650 is a joined string';
-}
-
-note("t.\$append");
-{
-my $importer = Catmandu::Importer::MARC->new( file => 't/rug01.aleph', 
type => "ALEPHSEQ" );
-my $fixer = Catmandu::Fix->new(fixes => ['marc_map(650a,t.$append)']);
-
-my $result = $fixer->fix($importer);
-
-my $field = $result->first->{t};
-
-ok $field , 'got an 650';
-
-is_deeply $field , [
-   'Semantics.',
-   'Proposition (Logic)',
-   'Speech acts (Linguistics)',
-   'Generative grammar.',
-   'Competence and performance (Linguistics)'
-] , '650 is an array of values';
-}
-
-note("t, split:1");
-{
-my $importer = Catmandu::Importer::MARC->new( file => 't/rug01.aleph', 
type => "ALEPHSEQ" );
-my $fixer = Catmandu::Fix->new(fixes => ['marc_map(650a,t,split:1)']);
-
-my $result = $fixer->fix($importer);
-
-my $field = $result->first->{t};
-
-ok $field , 'got an 650';
-
-is_deeply $field , [
-   'Semantics.',
-   'Proposition (Logic)',
-   'Speech acts (Linguistics)',
-   'Generative grammar.',
-   'Competence and performance (Linguistics)'
-] , '650 is an array of values';
-}
-
-note("t.\$append, split:1");
-{
-my $importer = Catmandu::Importer::MARC->new( file => 't/rug01.aleph', 
type => "ALEPHSEQ" );
-my $fixer = Catmandu::Fix->new(fixes => 
['marc_map(650a,t.$append,split:1)']);
-
-my $result = $fixer->fix($importer);
-
-my $field = $result->first->{t};
-
-ok $field , 'got an 650';
-
-is_deeply $field , [[
-   'Semantics.',
-   'Proposition (Logic)',
-   'Speech acts (Linguistics)',
-   'Generative grammar.',
-   'Competence and performance (Linguistics)'
-]] , '650 is an array of 

[libcatmandu-marc-perl] 106/208: Merge branch 'jorol-broken-append' into broken-append

2017-10-27 Thread Jonas Smedegaard
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 4d28df44d1c74b3edbbe1c6933c4ecd435e6753a
Merge: 4000a41 a405bdf
Author: Patrick Hochstenbach 
Date:   Thu Mar 2 13:32:38 2017 +0100

Merge branch 'jorol-broken-append' into broken-append

 t/23-mapping_rules.t | 528 +++
 1 file changed, 528 insertions(+)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 84/208: implemented marc_spec as a MARC method

2017-10-27 Thread Jonas Smedegaard
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 b89a3291bf397292c68e394a4c3546f814868316
Author: Carsten Klee 
Date:   Mon Jan 30 15:30:24 2017 +0100

implemented marc_spec as a MARC method
---
 lib/Catmandu/Fix/marc_spec.pm | 343 +++---
 lib/Catmandu/MARC.pm  | 264 
 2 files changed, 321 insertions(+), 286 deletions(-)

diff --git a/lib/Catmandu/Fix/marc_spec.pm b/lib/Catmandu/Fix/marc_spec.pm
index 535cb76..9bfad16 100644
--- a/lib/Catmandu/Fix/marc_spec.pm
+++ b/lib/Catmandu/Fix/marc_spec.pm
@@ -1,289 +1,60 @@
 package Catmandu::Fix::marc_spec;
 
-use Moo;
 use Catmandu::Sane;
-use Catmandu::Util qw(:data :array);
+use Catmandu::MARC;
+use Moo;
 use Catmandu::Fix::Has;
-use MARC::Spec;
-use Const::Fast;
+
+with 'Catmandu::Fix::Base';
 
 our $VERSION = '1.05';
 
 has spec   => ( fix_arg => 1 );
 has path   => ( fix_arg => 1 );
-has record => ( fix_opt => 1 );
 has split  => ( fix_opt => 1 );
 has join   => ( fix_opt => 1 );
 has value  => ( fix_opt => 1 );
 has pluck  => ( fix_opt => 1 );
 has invert => ( fix_opt => 1 );
 
-const my $NO_LENGTH=> -1;
-const my $FIELD_OFFSET => 3;
-const my $INVERT_LEVEL_DEFAULT => 4;
-const my $INVERT_LEVEL_3   => 3;
-const my $INVERT_LEVEL_2   => 2;
-const my $INVERT_LEVEL_1   => 1;
-const my $INVERT_LEVEL_0   => 0;
-const my $EMPTY=> q{};
-
-my $cache;
-
-sub fix {
-my ( $self, $data ) = @_;
-my $join_char   = $self->join // $EMPTY;
-my $record_key  = $self->record // 'record';
-my $_id = $data->{_id};
-my ( $path, $key )  = parse_data_path( $self->path );
-
-# get MARCspec
-if ( !defined $cache->{ $self->spec } ) {
-$cache->{ $self->spec } = MARC::Spec->parse( $self->spec );
-}
-my $ms = $cache->{ $self->spec };
-
-my $get_index_range = sub {
-my ( $spec, $total ) = @_;
-
-my $last_index  = $total - 1;
-my $index_start = $spec->index_start;
-my $index_end   = $spec->index_end;
-
-if ( '#' eq $index_start ) {
-if ( '#' eq $index_end or 0 eq $index_end ) { return [$last_index] 
}
-$index_start = $last_index;
-$index_end   = $last_index - $index_end;
-if ( 0 > $index_end ) { $index_end = 0 }
-}
-else {
-if ( $last_index < $index_start ) {
-return [$index_start];
-}# this will result to no hits
-}
-
-if ( '#' eq $index_end or $index_end > $last_index ) {
-$index_end = $last_index;
-}
-
-my $range =
-( $index_start <= $index_end )
-  ? [ $index_start .. $index_end ]
-  : [ $index_end .. $index_start ];
-return $range;
-};
-
-my $set_data = sub {
-my ($val) = @_;
-my $nested = data_at( $path, $data, create => 1, key => $key );
-set_data( $nested, $key, $val );
-return $data;
-};
-
-# filter by tag
-my @fields = ();
-my $field_spec = $ms->field;
-my $tag= $field_spec->tag;
-$tag   = qr/$tag/;
-unless ( @fields =
-grep { $_->[0] =~ /$tag/ } @{ $data->{$record_key} } )
-{
-return $data;
-}
-
-if (defined $field_spec->indicator1) {
-my $indicator1 = $field_spec->indicator1;
-$indicator1= qr/$indicator1/;
-unless( @fields =
-grep { defined $_->[1] && $_->[1] =~ /$indicator1/ } @fields)
-{
-return $data;
-}
-}
-if (defined $field_spec->indicator2) {
-my $indicator2 = $field_spec->indicator2;
-$indicator2= qr/$indicator2/;
-unless( @fields =
-grep { defined $_->[2] && $_->[2] =~ /$indicator2/ } @fields)
-{
-return $data;
-}
-}
-
-# filter by index
-if ( $NO_LENGTH != $field_spec->index_length ) {# index is requested
-my $index_range = $get_index_range->( $field_spec, scalar @fields );
-my $prevTag = $EMPTY;
-my $index   = 0;
-my $tag;
-my @filtered = ();
-for my $pos ( 0 .. $#fields ) {
-$tag = $fields[$pos][0];
-$index = ( $prevTag eq $tag or $EMPTY eq $prevTag ) ? $index : 0;
-if ( array_includes( $index_range, $index ) ) {
-push @filtered, $fields[$pos];
+sub emit {
+my ( $self, $fixer ) = @_;
+my $path = $fixer->split_path( $self->path );
+my $marc_obj = Catmandu::MARC->instance;
+
+# Precompile the marc_path to gain some speed
+my $spec = $marc_obj->parse_marc_spec( $self->spec );
+my $marc = $fixer->capture($marc_obj);
+my $marc_spec= $fixer->capture($spec);
+my $marc_opt 

[libcatmandu-marc-perl] 65/208: Adding a tutorial pod #39

2017-10-27 Thread Jonas Smedegaard
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 1d1e7b8cfad41f4d66d0f1c48226d97b189f3594
Author: Patrick Hochstenbach 
Date:   Wed Nov 2 14:59:13 2016 +0100

Adding a tutorial pod #39
---
 Build.PL   |   2 +-
 lib/Catmandu/MARC/Tutorial.pod | 147 +
 2 files changed, 148 insertions(+), 1 deletion(-)

diff --git a/Build.PL b/Build.PL
index a7f5fd3..215b552 100644
--- a/Build.PL
+++ b/Build.PL
@@ -1,5 +1,5 @@
 
-# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild 
v5.047.
+# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild 
v5.039.
 use strict;
 use warnings;
 
diff --git a/lib/Catmandu/MARC/Tutorial.pod b/lib/Catmandu/MARC/Tutorial.pod
new file mode 100644
index 000..11aa994
--- /dev/null
+++ b/lib/Catmandu/MARC/Tutorial.pod
@@ -0,0 +1,147 @@
+=head1 NAME
+
+Catmandu::MARC::Tutorial - A documentation-only module for new users of 
Catmandu::MARC
+
+=head1 SYNOPSIS
+
+  perldoc Catmandu::MARC::Tutorial
+
+=head1 READING
+
+=head2 Convert MARC records into JSON
+
+The command below converts file data.mrc into JSON:
+
+   $ catmandu convert MARC to JSON < data.mrc
+
+=head2 Convert MARC records into YAML
+
+   $ catmandu convert MARC to YAML < data.mrc
+
+=head2 Create a CSV file containing all the titles
+
+To extract data from a MARC record on needs a Fix routine. This
+is a small language to manipulate data. In the example below
+we extract all 245 fields from MARC:
+
+   $ catmandu convert MARC to CSV --fix 'marc_map(245,title); retain(title)' < 
data.mrc
+
+The Fix C puts the MARC 245 field in the C field.
+The Fix C makes sure only the title field ends up in the
+CSV file.
+
+=head2 Create a CSV file containing only the 245$a and 245$c subfields
+
+The C Fix can get one or more subfields to extract from MARC:
+
+   $ catmandu convert MARC to CSV --fix 'marc_map(245ac,title); retain(title)' 
< data.mrc
+
+=head2 Create a CSV file which contains a repeated field
+
+In the example below the 650a field can be repeated in some marc records.
+We will join all the repetitions in an comma delimited list for each record.
+
+First we create a Fix file containing all the Fixes, then we execute the
+catmandu command.
+
+Open a text editor and create the C file with content:
+
+marc_map(650a,subject.$append)
+join_field(subject,",")
+retain(subject)
+
+And execute the command:
+
+   $ catmandu convert MARC to CSV --fix myfix.fix < data.mrc
+
+=head2 Create a list of the number of subjects per record
+
+We will create a list of subjects (650a) and count the number of items
+in this list for each record. The CSV file will contain the C<_id> (record
+identifier) and C the number of 650a fields.
+
+Open a text editor and create the C file with content:
+
+marc_map(650a,subject.$append)
+count(subject)
+retain(_id, subject)
+
+And execute the command:
+
+   $ catmandu convert MARC to CSV --fix myfix.fix < data.mrc
+
+=head2 Create a list of all ISBN numbers in the data
+
+We will create first a Fix script which Cs only the records
+that contain an ISBN field (022$a). All the isbns found we will
+print inline using the C Fix.
+
+Open a text editor and create the C file with content:
+
+marc_map(020a,isbn.$append)
+
+select exists(isbn)
+
+# Loop over the ISBNs and print them to a CSV exporter
+do list(path:isbn,var:c)
+ move_field(c,result.isbn)
+ add_to_exporter(result,CSV)
+end
+
+Execute the following catmandu command, notice that we ignore the normal
+output with help of the C exporter (all output will be generated)
+by the Fix script:
+
+   $ catmandu convert MARC to Null --fix myfix.fix < data.mrc
+
+=head2 Create a list of all unique ISBN numbers in the data
+
+Here we can use the Fix script as in the previous example and use the
+UNIX "sort -u" command:
+
+   $ catmandu convert MARC to Null --fix myfix.fix < data.mrc | sort -u
+
+=head2 Create a list of all ISBN numbers for records with type 920a == book
+
+In the example we need an extra condition for match the content of the
+920a field against the string C.
+
+Open a text editor and create the C file with content:
+
+marc_map(020a,isbn.$append)
+marc_map(920a,type)
+
+select all_match(type,"book")
+select exists(isbn)
+
+# Loop over the ISBNs and print them to a CSV exporter
+do list(path:isbn,var:c)
+ move_field(c,result.isbn)
+ add_to_exporter(result,CSV)
+end
+
+And run the command:
+
+$ catmandu convert MARC to Null --fix myfix.fix < data.mrc
+
+=head1 WRITING
+
+=head2 Convert a MARC record into a MARC record (do nothing)
+
+$ catmandu convert MARC to MARC < data.mrc > output.mrc
+
+=head2 Add a 920a field with value 'checked' to all records
+
+$ catmandu convert MARC to MARC --fix 

[libcatmandu-marc-perl] 81/208: Fixing version number of marc_spec

2017-10-27 Thread Jonas Smedegaard
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 1c61d82f08f993cec6e19c209c209e18fbad7dc7
Author: Patrick Hochstenbach 
Date:   Fri Jan 20 08:21:03 2017 +0100

Fixing version number of marc_spec
---
 lib/Catmandu/Fix/marc_spec.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Catmandu/Fix/marc_spec.pm b/lib/Catmandu/Fix/marc_spec.pm
index a2c638c..535cb76 100644
--- a/lib/Catmandu/Fix/marc_spec.pm
+++ b/lib/Catmandu/Fix/marc_spec.pm
@@ -7,7 +7,7 @@ use Catmandu::Fix::Has;
 use MARC::Spec;
 use Const::Fast;
 
-our $VERSION = '0.0.1';
+our $VERSION = '1.05';
 
 has spec   => ( fix_arg => 1 );
 has path   => ( fix_arg => 1 );

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 94/208: Fixing error in split/pluck

2017-10-27 Thread Jonas Smedegaard
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 d9db0e563c8766d5c88e54272b32c6d73f0b3d9e
Author: Patrick Hochstenbach 
Date:   Tue Feb 28 10:53:14 2017 +0100

Fixing error in split/pluck
---
 Build.PL | 2 +-
 cpanfile | 2 +-
 lib/Catmandu/MARC.pm | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Build.PL b/Build.PL
index 3c3999e..49e3933 100644
--- a/Build.PL
+++ b/Build.PL
@@ -34,7 +34,7 @@ my %module_build_args = (
 "MARC::Lint" => 0,
 "MARC::Parser::RAW" => 0,
 "MARC::Record" => "v2.0.6",
-"MARC::Spec" => 0,
+"MARC::Spec" => "v0.1.0",
 "Memoize" => 0,
 "Moo" => "1.0",
 "MooX::Singleton" => 0,
diff --git a/cpanfile b/cpanfile
index a9873a3..9aa896b 100644
--- a/cpanfile
+++ b/cpanfile
@@ -22,7 +22,7 @@ requires 'MARC::Record', '2.0.6';
 requires 'MARC::Lint', '0';
 requires 'MARC::Parser::RAW', '0';
 requires 'Const::Fast', '0.014';
-requires 'MARC::Spec';
+requires 'MARC::Spec', '0.1.0';
 requires 'Memoize', '0';
 requires 'Moo', '1.0';
 requires 'MooX::Singleton', '0';
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 9895d65..a164553 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -71,9 +71,10 @@ sub marc_map {
 push @{ $_h->{ $field->[$i] } } , $field->[$i + 1];
 }
 my $subfield = $context->{subfield};
-$subfield =~ s{^[a-zA-Z0-9]}{}g;
+$subfield =~ s{[^a-zA-Z0-9]}{}g;
 for my $c (split('',$subfield)) {
-push @$v , @{ $_h->{$c} } if exists $_h->{$c};
+my $val = $_h->{$c} // [undef];
+push @$v , @{ $val } ;
 }
 }
 else {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 90/208: Merge branch 'cKlee-dev' into dev

2017-10-27 Thread Jonas Smedegaard
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 e72fc0c454360ae4813f7d556fda85c51d251ad9
Merge: fe0afeb 0b98612
Author: Patrick Hochstenbach 
Date:   Mon Jan 30 16:37:32 2017 +0100

Merge branch 'cKlee-dev' into dev

 lib/Catmandu/Fix/marc_spec.pm | 344 +++---
 lib/Catmandu/MARC.pm  | 264 
 2 files changed, 322 insertions(+), 286 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 101/208: Fixinf marc_spec append

2017-10-27 Thread Jonas Smedegaard
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 57d379fc023c6a978aa6271d27735daf8451bb0b
Author: Patrick Hochstenbach 
Date:   Thu Mar 2 08:46:19 2017 +0100

Fixinf marc_spec append
---
 lib/Catmandu/Fix/marc_map.pm  |  1 +
 lib/Catmandu/Fix/marc_spec.pm | 15 ++--
 lib/Catmandu/MARC.pm  | 32 +---
 t/22-append-path.t| 86 +++
 4 files changed, 125 insertions(+), 9 deletions(-)

diff --git a/lib/Catmandu/Fix/marc_map.pm b/lib/Catmandu/Fix/marc_map.pm
index 1b2730c..165ba1b 100644
--- a/lib/Catmandu/Fix/marc_map.pm
+++ b/lib/Catmandu/Fix/marc_map.pm
@@ -50,6 +50,7 @@ if (my ${result} = ${marc}->marc_map(
 ${result} = ref(${result}) ? ${result} : [${result}];
 for ${current_value} (\@{${result}}) {
 EOF
+
 $perl .= $fixer->emit_create_path(
 $var,
 $path,
diff --git a/lib/Catmandu/Fix/marc_spec.pm b/lib/Catmandu/Fix/marc_spec.pm
index 31c4bde..50a1d4c 100644
--- a/lib/Catmandu/Fix/marc_spec.pm
+++ b/lib/Catmandu/Fix/marc_spec.pm
@@ -20,6 +20,7 @@ has invert => ( fix_opt => 1 );
 sub emit {
 my ( $self, $fixer ) = @_;
 my $path = $fixer->split_path( $self->path );
+my $key  = $path->[-1];
 my $marc_obj = Catmandu::MARC->instance;
 
 # Precompile the marc_path to gain some speed
@@ -31,27 +32,35 @@ sub emit {
 '-split'  => $self->split  // 0 ,
 '-pluck'  => $self->pluck  // 0 ,
 '-invert' => $self->invert // 0 ,
-'-value'  => $self->value
+'-value'  => $self->value ,
+'-append' => $key eq '$append'
 });
 my $var  = $fixer->var;
 my $result   = $fixer->generate_var;
+my $current_value = $fixer->generate_var;
 
-my $perl =<emit_declare_vars($current_value, "[]");
+$perl .=<marc_spec(
 ${var},
 ${marc_spec},
 ${marc_opt}) ) {
+${result} = ref(${result}) ? ${result} : [${result}];
+for ${current_value} (\@{${result}}) {
 EOF
+
 $perl .= $fixer->emit_create_path(
 $var,
 $path,
 sub {
 my $var2 = shift;
-"${var2} = ${result}"
+"${var2} = ${current_value}"
 }
 );
 
 $perl .=<{'-pluck'} // 0;
 my $value_set  = $_[3]->{'-value'} // undef;
 my $invert = $_[3]->{'-invert'} // 0;
+my $append = $_[3]->{'-append'} // undef;
 
 my $vals;
 
@@ -521,9 +522,18 @@ sub marc_spec {
 
 unless (@subfields) { return $vals }
 
-$vals = ($split)
-  ? [@subfields]
-  : join( $join_char, @subfields );
+if ($split) {
+$vals = [[@subfields]];
+}
+elsif ($append) {
+$vals = [@subfields];
+}
+elsif (@subfields) {
+$vals = join( $join_char, @subfields );
+}
+else {
+$vals = undef;
+}
 }
 else {# no particular subfields requested
 my $char_start = $field_spec->char_start;
@@ -553,10 +563,20 @@ sub marc_spec {
 }
 unless (@mapped) { return $vals }
 
-$vals = ($split)
-  ? [@mapped]
-  : join $join_char, @mapped;
+if ($split) {
+$vals = [[@mapped]]
+}
+elsif ($append) {
+$vals = [@mapped]
+}
+elsif (@mapped) {
+$vals = join $join_char, @mapped;
+}
+else {
+$vals = undef;
+}
 }
+
 return $vals;
 }
 
diff --git a/t/22-append-path.t b/t/22-append-path.t
index 31f111a..3a7cd76 100644
--- a/t/22-append-path.t
+++ b/t/22-append-path.t
@@ -10,6 +10,8 @@ use Test::More;
 use Catmandu::Importer::MARC;
 use Catmandu::Fix;
 
+note("marc_map-");
+
 note("t");
 {
 my $importer = Catmandu::Importer::MARC->new( file => 't/rug01.aleph', 
type => "ALEPHSEQ" );
@@ -92,4 +94,88 @@ note("t.\$append, split:1");
 ]] , '650 is an array of array of values';
 }
 
+note("marc_spec-");
+
+note("t");
+{
+my $importer = Catmandu::Importer::MARC->new( file => 't/rug01.aleph', 
type => "ALEPHSEQ" );
+my $fixer = Catmandu::Fix->new(fixes => ['marc_spec(650$a,t)']);
+
+my $result = $fixer->fix($importer);
+
+my $field = $result->first->{t};
+
+ok $field , 'got an 650';
+
+my 

[libcatmandu-marc-perl] 96/208: Adding marc_map pluck/split feature to changes

2017-10-27 Thread Jonas Smedegaard
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 a9c4dcd8b936141258622dc37424db3ef09ea5aa
Author: Patrick Hochstenbach 
Date:   Tue Feb 28 11:04:30 2017 +0100

Adding marc_map pluck/split feature to changes
---
 Changes | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changes b/Changes
index ec5aa7e..441d50c 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+  - A marc_map(...,...,pluck:1,split:1) will return *all* the subfields 
specified in the path (undef when they don't exist in the MARC)
 
 1.06  2017-01-31 14:57:19 CET
   - Adding support for inline marc_spec

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 91/208: Fixing POD

2017-10-27 Thread Jonas Smedegaard
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 ed12aad68a4875ec91272ee21b76f624808b297a
Author: Patrick Hochstenbach 
Date:   Mon Jan 30 16:39:36 2017 +0100

Fixing POD
---
 lib/Catmandu/Exporter/MARC.pm | 8 
 lib/Catmandu/Importer/MARC.pm | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index 1ff43e8..fdb5f22 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -43,10 +43,10 @@ Catmandu::Exporter::MARC - Exporter for MARC records
 $ catmandu convert MARC --type ISO to MARC --type XML < /foo/bar.mrc
 
 # From Perl
-use Catmandu 'all';
+use Catmandu;
 
-my $importer = importer('MARC', file => "/foo/bar.mrc" , type => 'ISO');
-my $exporter = exporter('MARC', file => "marc.xml", type => "XML" );
+my $importer = Catmandu->importer('MARC', file => "/foo/bar.mrc" , type => 
'ISO');
+my $exporter = Catmandu->exporter('MARC', file => "marc.xml", type => 
"XML" );
 
 $exporter->add($importer);
 $exporter->commit;
@@ -90,7 +90,7 @@ ALEPHSEQ: L
 E.g.
 
 catmandu convert MARC --type XML to MARC --type ISO < marc.xml > marc.iso
-
+
 =head1 SEE ALSO
 
 L
diff --git a/lib/Catmandu/Importer/MARC.pm b/lib/Catmandu/Importer/MARC.pm
index 4b9d401..d573f0d 100644
--- a/lib/Catmandu/Importer/MARC.pm
+++ b/lib/Catmandu/Importer/MARC.pm
@@ -44,7 +44,7 @@ Catmandu::Importer::MARC - Package that imports MARC data
 
 =head1 SYNOPSIS
 
-use Catmandu -all;
+use Catmandu;
 
 # import records from file
 my $importer = Catmandu->importer('MARC',file => '/foo/bar.mrc');

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 79/208: Updating changes

2017-10-27 Thread Jonas Smedegaard
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 7bd46841c7fc8fdc79dd3f55cf5471b99bd22585
Author: Patrick Hochstenbach 
Date:   Thu Jan 19 10:36:53 2017 +0100

Updating changes
---
 Changes | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changes b/Changes
index 4983bb6..775814c 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,7 @@ Revision history for Catmandu-MARC
 {{$NEXT}}
   - Adding Carsten Klee's MARC::Spec contribution
   - Adding Carsten as contributor
+  - Buffering record in XML exporter for better serialization speed
 
 1.04  2017-01-18 09:23:26 CET
   - Skipping new lines in ALEPHSEQ exports

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 76/208: Updating readme

2017-10-27 Thread Jonas Smedegaard
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 6c2310497575561ff07080eef53e12d862e77b46
Author: Patrick Hochstenbach 
Date:   Thu Jan 19 10:31:44 2017 +0100

Updating readme
---
 README.md | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 622e69b..11772a9 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,7 @@ Catmandu::MARC - Catmandu modules for working with MARC data
 - [Catmandu::Importer::MARC](https://metacpan.org/pod/Catmandu::Importer::MARC)
 - [Catmandu::Exporter::MARC](https://metacpan.org/pod/Catmandu::Exporter::MARC)
 - [Catmandu::Fix::marc\_map](https://metacpan.org/pod/Catmandu::Fix::marc_map)
+- 
[Catmandu::Fix::marc\_spec](https://metacpan.org/pod/Catmandu::Fix::marc_spec)
 - [Catmandu::Fix::marc\_add](https://metacpan.org/pod/Catmandu::Fix::marc_add)
 - 
[Catmandu::Fix::marc\_remove](https://metacpan.org/pod/Catmandu::Fix::marc_remove)
 - [Catmandu::Fix::marc\_xml](https://metacpan.org/pod/Catmandu::Fix::marc_xml)
@@ -77,7 +78,8 @@ processing at 
[https://github.com/LibreCat/Catmandu/wiki](https://github.com/Lib
 [Catmandu](https://metacpan.org/pod/Catmandu),
 [Catmandu::Importer](https://metacpan.org/pod/Catmandu::Importer),
 [Catmandu::Fix](https://metacpan.org/pod/Catmandu::Fix),
-[Catmandu::Store](https://metacpan.org/pod/Catmandu::Store)
+[Catmandu::Store](https://metacpan.org/pod/Catmandu::Store),
+[MARC::Spec](https://metacpan.org/pod/MARC::Spec)
 
 # AUTHOR
 
@@ -90,6 +92,7 @@ Patrick Hochstenbach, ``
 - Johann Rolschewski, `jorol at cpan.org`
 - Chris Cormack
 - Robin Sheat
+- Carsten Klee, `klee at cpan.org`
 
 # LICENSE AND COPYRIGHT
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 69/208: 1.03

2017-10-27 Thread Jonas Smedegaard
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 d216efa8b3d997154300536f30ff627e80d08876
Author: Patrick Hochstenbach 
Date:   Thu Nov 3 08:48:45 2016 +0100

1.03
---
 Build.PL | 2 +-
 Changes  | 2 ++
 lib/Catmandu/Exporter/MARC.pm| 2 +-
 lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/Base.pm   | 2 +-
 lib/Catmandu/Exporter/MARC/ISO.pm| 2 +-
 lib/Catmandu/Exporter/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Exporter/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Exporter/MARC/XML.pm| 2 +-
 lib/Catmandu/Fix/Bind/marc_each.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has.pm   | 2 +-
 lib/Catmandu/Fix/Condition/marc_has_many.pm  | 2 +-
 lib/Catmandu/Fix/Condition/marc_match.pm | 2 +-
 lib/Catmandu/Fix/Inline/marc_add.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_map.pm  | 2 +-
 lib/Catmandu/Fix/Inline/marc_remove.pm   | 2 +-
 lib/Catmandu/Fix/Inline/marc_set.pm  | 2 +-
 lib/Catmandu/Fix/marc_add.pm | 2 +-
 lib/Catmandu/Fix/marc_decode_dollar_subfields.pm | 2 +-
 lib/Catmandu/Fix/marc_in_json.pm | 2 +-
 lib/Catmandu/Fix/marc_map.pm | 2 +-
 lib/Catmandu/Fix/marc_remove.pm  | 2 +-
 lib/Catmandu/Fix/marc_set.pm | 2 +-
 lib/Catmandu/Fix/marc_xml.pm | 2 +-
 lib/Catmandu/Importer/MARC.pm| 2 +-
 lib/Catmandu/Importer/MARC/ALEPHSEQ.pm   | 2 +-
 lib/Catmandu/Importer/MARC/Decoder.pm| 2 +-
 lib/Catmandu/Importer/MARC/ISO.pm| 2 +-
 lib/Catmandu/Importer/MARC/Lint.pm   | 2 +-
 lib/Catmandu/Importer/MARC/MARCMaker.pm  | 2 +-
 lib/Catmandu/Importer/MARC/MiJ.pm| 2 +-
 lib/Catmandu/Importer/MARC/MicroLIF.pm   | 2 +-
 lib/Catmandu/Importer/MARC/RAW.pm| 2 +-
 lib/Catmandu/Importer/MARC/Record.pm | 2 +-
 lib/Catmandu/Importer/MARC/XML.pm| 2 +-
 lib/Catmandu/MARC.pm | 2 +-
 36 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/Build.PL b/Build.PL
index 215b552..b215536 100644
--- a/Build.PL
+++ b/Build.PL
@@ -18,7 +18,7 @@ my %module_build_args = (
 "Patrick Hochstenbach, C<<  >>"
   ],
   "dist_name" => "Catmandu-MARC",
-  "dist_version" => "1.02",
+  "dist_version" => "1.03",
   "license" => "perl",
   "module_name" => "Catmandu::MARC",
   "recursive_test_files" => 1,
diff --git a/Changes b/Changes
index f509b7d..cf19545 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+
+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/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index 50f665d..c11b918 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -76,7 +76,7 @@ package Catmandu::Exporter::MARC;
 use Catmandu::Sane;
 use Moo;
 
-our $VERSION = '1.02';
+our $VERSION = '1.03';
 
 has type   => (is => 'ro' , default => sub { 'ISO' });
 has _exporter  => (is => 'ro' , lazy => 1 , builder => '_build_exporter' , 
handles => 'Catmandu::Exporter');
diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm 
b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
index 469e9f0..be9288c 100644
--- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
+++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm
@@ -58,7 +58,7 @@ use Catmandu::Util qw(xml_escape is_different :array :is);
 use List::Util;
 use Moo;
 
-our $VERSION = '1.02';
+our $VERSION = '1.03';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/Base.pm 
b/lib/Catmandu/Exporter/MARC/Base.pm
index c82a12e..6306bac 100644
--- a/lib/Catmandu/Exporter/MARC/Base.pm
+++ b/lib/Catmandu/Exporter/MARC/Base.pm
@@ -3,7 +3,7 @@ use Moo::Role;
 use MARC::Record;
 use MARC::Field;
 
-our $VERSION = '1.02';
+our $VERSION = '1.03';
 
 sub _raw_to_marc_record {
 my ($self,$data) = @_;
diff --git a/lib/Catmandu/Exporter/MARC/ISO.pm 
b/lib/Catmandu/Exporter/MARC/ISO.pm
index 3e9ba8c..15c3f56 100644
--- a/lib/Catmandu/Exporter/MARC/ISO.pm
+++ b/lib/Catmandu/Exporter/MARC/ISO.pm
@@ -60,7 +60,7 @@ use MARC::Record;
 use MARC::Field;
 use MARC::File::USMARC;
 
-our $VERSION = '1.02';
+our $VERSION = '1.03';
 
 with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
 
diff --git a/lib/Catmandu/Exporter/MARC/MARCMaker.pm 
b/lib/Catmandu/Exporter/MARC/MARCMaker.pm
index e7f73f3..c6889a6 100644
--- a/lib/Catmandu/Exporter/MARC/MARCMaker.pm
+++ b/lib/Catmandu/Exporter/MARC/MARCMaker.pm
@@ -60,7 +60,7 @@ use MARC::Record;
 

[libcatmandu-marc-perl] 102/208: Fixing one tests according to the new rules

2017-10-27 Thread Jonas Smedegaard
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 6e2677f0baa94d219fd93c5859829732c4e8426d
Author: Patrick Hochstenbach 
Date:   Thu Mar 2 11:45:04 2017 +0100

Fixing one tests according to the new rules
---
 lib/Catmandu/MARC.pm | 4 ++--
 t/21-marc-spec.t | 6 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index cdbfe8d..21f02e6 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -564,10 +564,10 @@ sub marc_spec {
 unless (@mapped) { return $vals }
 
 if ($split) {
-$vals = [[@mapped]]
+$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 d9cd871..1fa3319 100644
--- a/t/21-marc-spec.t
+++ b/t/21-marc-spec.t
@@ -27,7 +27,11 @@ is  $records->[9]->{my}{subjects}{joined}, 'Perl (Computer 
program language)###W
 
 is_deeply
 $records->[9]->{my}{append}{subjects},
-['Perl (Computer program language)Web servers.Cross-platform software 
development.'],
+[
+'Perl (Computer program language)',
+'Web servers.',
+'Cross-platform software development.'
+],
 q|fix: marc_spec('650', my.append.subjects.$append);|;
 
 is_deeply

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 88/208: Merge branch 'dev' of https://github.com/cKlee/Catmandu-MARC into cKlee-dev

2017-10-27 Thread Jonas Smedegaard
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 8310f63a4705b64f2aa522541c213a7788141422
Merge: fe0afeb e27ae76
Author: Patrick Hochstenbach 
Date:   Mon Jan 30 16:35:31 2017 +0100

Merge branch 'dev' of https://github.com/cKlee/Catmandu-MARC into cKlee-dev

 lib/Catmandu/Fix/marc_spec.pm | 343 +++---
 lib/Catmandu/MARC.pm  | 264 
 2 files changed, 321 insertions(+), 286 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 63/208: fix documentation of MiJ

2017-10-27 Thread Jonas Smedegaard
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 ea9411f9579c41d6d7c12718be46617da08bbe09
Author: Johann Rolschewski 
Date:   Mon Oct 17 15:19:19 2016 +0200

fix documentation of MiJ
---
 lib/Catmandu/Exporter/MARC/MiJ.pm | 6 +++---
 lib/Catmandu/Importer/MARC/MiJ.pm | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/Catmandu/Exporter/MARC/MiJ.pm 
b/lib/Catmandu/Exporter/MARC/MiJ.pm
index 661d3bb..9b784e4 100644
--- a/lib/Catmandu/Exporter/MARC/MiJ.pm
+++ b/lib/Catmandu/Exporter/MARC/MiJ.pm
@@ -5,13 +5,13 @@ Catmandu::Exporter::MARC::MiJ - Exporter for MARC records to 
MARC in JSON
 =head1 SYNOPSIS
 
 # From the command line
-$ catmandu convert MARC --type XML to MARC --type MiJ < /foo/data.mrc
+$ catmandu convert MARC --type XML to MARC --type MiJ < /foo/bar.xml
 
 # From Perl
 use Catmandu;
 
-my $importer = Catmandu->importer('MARC', file => "/foo/bar.mrc" , type => 
'XML');
-my $exporter = Catmandu->exporter('MARC', file => "marc.xml", type => 
'MiJ' );
+my $importer = Catmandu->importer('MARC', file => "/foo/bar.xml" , type => 
'XML');
+my $exporter = Catmandu->exporter('MARC', file => "bar.json", type => 
'MiJ' );
 
 $exporter->add($importer);
 $exporter->commit;
diff --git a/lib/Catmandu/Importer/MARC/MiJ.pm 
b/lib/Catmandu/Importer/MARC/MiJ.pm
index 01f3e4f..6b31db3 100644
--- a/lib/Catmandu/Importer/MARC/MiJ.pm
+++ b/lib/Catmandu/Importer/MARC/MiJ.pm
@@ -5,13 +5,13 @@ Catmandu::Importer::MARC::MiJ - Package that imports 
MARC-in-JSON records
 =head1 SYNOPSIS
 
 # From the command line
-$ catmandu convert MARC --type MiJ --fix "marc_map('245a','title')" < 
/foo/data.js
+$ catmandu convert MARC --type MiJ --fix "marc_map('245a','title')" < 
/foo/bar.json
 
 # From perl
 use Catmandu;
 
 # import records from file
-my $importer = Catmandu->importer('MARC',file => '/foo/data.js', type => 
'MiJ');
+my $importer = Catmandu->importer('MARC',file => '/foo/bar.json', type => 
'MiJ');
 my $fixer= Catmandu->fixer("marc_map('245a','title')");
 
 $importer->each(sub {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 64/208: Merge pull request #48 from jorol/dev

2017-10-27 Thread Jonas Smedegaard
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 dbd640d69986b5099e3e63b98e468b1519d14642
Merge: 0ca9863 ea9411f
Author: Patrick Hochstenbach 
Date:   Wed Nov 2 14:05:15 2016 +0100

Merge pull request #48 from jorol/dev

fix documentation of MiJ

 lib/Catmandu/Exporter/MARC/MiJ.pm | 6 +++---
 lib/Catmandu/Importer/MARC/MiJ.pm | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)


-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


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

2017-10-27 Thread Jonas Smedegaard
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 
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<<  >>"
   ],
   "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 !~ /1 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 =~ /^1/, 'test id');
 ok($xml =~ /1 100   L \$\$aDavis, Miles\$\$cTest/, 'test subfields');
-ok($xml !~ /1 500/, 'test skip empty subfields');
\ No newline at end of file
+ok($xml !~ /1 500/, 'test skip empty subfields');
+ok($xml =~ /1 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

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 83/208: Rewrite documentation of ::{Importer, Exporter}::MARC

2017-10-27 Thread Jonas Smedegaard
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 e0aabba5bcf0a0d0772b0f2484b6e3d6ac30f2a0
Author: Jakob Voss 
Date:   Tue Jan 24 13:38:39 2017 +0100

Rewrite documentation of ::{Importer,Exporter}::MARC
---
 lib/Catmandu/Exporter/MARC.pm | 113 ++-
 lib/Catmandu/Importer/MARC.pm | 203 --
 2 files changed, 141 insertions(+), 175 deletions(-)

diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index 7680308..b465d56 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -1,3 +1,38 @@
+package Catmandu::Exporter::MARC;
+use Catmandu::Sane;
+use Moo;
+
+our $VERSION = '1.05';
+
+has type   => (is => 'ro' , default => sub { 'ISO' });
+has _exporter  => (is => 'ro' , lazy => 1 , builder => '_build_exporter' , 
handles => 'Catmandu::Exporter');
+has _exporter_args => (is => 'rwp', writer => '_set_exporter_args');
+
+sub _build_exporter {
+my ($self) = @_;
+
+my $type = $self->type;
+
+my $pkg = 
Catmandu::Util::require_package($type,'Catmandu::Exporter::MARC');
+
+$pkg->new($self->_exporter_args);
+}
+
+sub BUILD {
+my ($self,$args) = @_;
+$self->_set_exporter_args($args);
+
+# keep USMARC temporary as alias for ISO, remove in future version
+# print deprecation warning
+if ($self->{type} eq 'USMARC') {
+$self->{type} = 'ISO';
+warn( "deprecated", "Oops! Exporter \"USMARC\" is deprecated. Use 
\"ISO\" instead." );
+}
+}
+
+1;
+__END__
+
 =head1 NAME
 
 Catmandu::Exporter::MARC - Exporter for MARC records
@@ -8,10 +43,10 @@ Catmandu::Exporter::MARC - Exporter for MARC records
 $ catmandu convert MARC --type ISO to MARC --type XML < /foo/bar.mrc
 
 # From Perl
-use Catmandu;
+use Catmandui -all;
 
-my $importer = Catmandu->importer('MARC', file => "/foo/bar.mrc" , type => 
'ISO');
-my $exporter = Catmandu->exporter('MARC', file => "marc.xml", type => 
"XML" );
+my $importer = importer('MARC', file => "/foo/bar.mrc" , type => 'ISO');
+my $exporter = exporter('MARC', file => "marc.xml", type => "XML" );
 
 $exporter->add($importer);
 $exporter->commit;
@@ -23,85 +58,29 @@ to a file or the standard output.
 
 =head1 CONFIGURATION
 
+In addition to the configuration provided by L (C,
+C, etc.) the exporter can be configured with the following parameters:
+
 =over
 
 =item type
 
-Create a new MARC exporter of the given type. Currently we support:
+Describes the MARC syntax variant. Supported values include:
 
 =over
 
-=item * USMARC: alias for ISO, B
-
-=item * ISO: L
+=item * ISO: L (default)
 
 =item * XML: L
 
 =item * MARCMaker: L
 
-=item * MiJ: L (Marc in Json)
+=item * MiJ: L (MARC in JSON)
 
 =item * ALEPHSEQ: L
 
-=back
-
-=item file
-
-Write output to a local file given by its path or file handle.  Alternatively a
-scalar reference can be passed to write to a string and a code reference can be
-used to write to a callback function.
-
-=item fh
-
-Write the output to an L. If not specified,
-L is used to create the output
-handle from the C argument or by using STDOUT.
-
-=item fix
-
-An ARRAY of one or more fixes or file scripts to be applied to exported items.
-
-=item encoding
-
-Binmode of the output stream C. Set to "C<:utf8>" by default.
-
-=back
-
 =head1 SEE ALSO
 
-L
-
-=cut
-package Catmandu::Exporter::MARC;
-use Catmandu::Sane;
-use Moo;
+L
 
-our $VERSION = '1.05';
-
-has type   => (is => 'ro' , default => sub { 'ISO' });
-has _exporter  => (is => 'ro' , lazy => 1 , builder => '_build_exporter' , 
handles => 'Catmandu::Exporter');
-has _exporter_args => (is => 'rwp', writer => '_set_exporter_args');
-
-sub _build_exporter {
-my ($self) = @_;
-
-my $type = $self->type;
-
-my $pkg = 
Catmandu::Util::require_package($type,'Catmandu::Exporter::MARC');
-
-$pkg->new($self->_exporter_args);
-}
-
-sub BUILD {
-my ($self,$args) = @_;
-$self->_set_exporter_args($args);
-
-# keep USMARC temporary as alias for ISO, remove in future version
-# print deprecation warning
-if ($self->{type} eq 'USMARC') {
-$self->{type} = 'ISO';
-warn( "deprecated", "Oops! Exporter \"USMARC\" is deprecated. Use 
\"ISO\" instead." );
-}
-}
-
-1;
+=back
diff --git a/lib/Catmandu/Importer/MARC.pm b/lib/Catmandu/Importer/MARC.pm
index fe8743d..1a89307 100644
--- a/lib/Catmandu/Importer/MARC.pm
+++ b/lib/Catmandu/Importer/MARC.pm
@@ -1,86 +1,137 @@
+package Catmandu::Importer::MARC;
+use Catmandu::Sane;
+use Catmandu::Util;
+use Moo;
+
+our $VERSION = '1.05';
+
+has type   => (is => 'ro' , default => sub { 'ISO' });
+has _importer  => (is => 'ro' , lazy => 1 , builder => '_build_importer' , 
handles => ['generator']);

[libcatmandu-marc-perl] 92/208: Adding POD

2017-10-27 Thread Jonas Smedegaard
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 6ba3b1d34ee061628d4ae14c9d35afd97a3ad844
Author: Patrick Hochstenbach 
Date:   Tue Jan 31 13:55:29 2017 +0100

Adding POD
---
 Changes|  2 ++
 lib/Catmandu/MARC/Tutorial.pod | 14 +++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Changes b/Changes
index d1a759b..48b15f7 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Catmandu-MARC
 
 {{$NEXT}}
+  - Adding support for inline marc_spec
+  - Updated POD
 
 1.05  2017-01-19 16:05:10 CET
   - Adding Carsten Klee's MARC::Spec contribution
diff --git a/lib/Catmandu/MARC/Tutorial.pod b/lib/Catmandu/MARC/Tutorial.pod
index c9768b3..febddf6 100644
--- a/lib/Catmandu/MARC/Tutorial.pod
+++ b/lib/Catmandu/MARC/Tutorial.pod
@@ -8,15 +8,23 @@ Catmandu::MARC::Tutorial - A documentation-only module for 
new users of Catmandu
 
 =head1 READING
 
-=head2 Convert MARC records into JSON
+=head2 Convert MARC21 records into JSON
 
 The command below converts file data.mrc into JSON:
 
$ catmandu convert MARC to JSON < data.mrc
 
-=head2 Convert MARC records into YAML
+=head2 Convert MARC21 records into MARC-XML
 
-   $ catmandu convert MARC to YAML < data.mrc
+   $ catmandu convert MARC to MARC --type XML < data.mrc
+
+=head2 Convert UNIMARC records into JSON, XML, ...
+
+To read UNIMARC records use the RAW parser to get the correct character
+encoding.
+
+   $ catmandu convert MARC --type RAW to JSON < data.mrc
+   $ catmandu convert MARC --type RAW to MARC --type XML < data.mrc
 
 =head2 Create a CSV file containing all the titles
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 89/208: Fixing indent

2017-10-27 Thread Jonas Smedegaard
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 0b98612724539c15f1a2fab26cedaca26cabe67f
Author: Patrick Hochstenbach 
Date:   Mon Jan 30 16:37:20 2017 +0100

Fixing indent
---
 lib/Catmandu/Fix/marc_spec.pm | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/Catmandu/Fix/marc_spec.pm b/lib/Catmandu/Fix/marc_spec.pm
index 9bfad16..be4abe2 100644
--- a/lib/Catmandu/Fix/marc_spec.pm
+++ b/lib/Catmandu/Fix/marc_spec.pm
@@ -58,6 +58,7 @@ EOF
 }
 
 1;
+
 __END__
 
 =encoding utf-8
@@ -327,15 +328,15 @@ last pattern for every subfield. E.g.
marc_spec('020$a[0]/#-1' my.other.subfields, invert:1)
 
 =head1 INLINE
- 
+
 This Fix can be used inline in a Perl script:
- 
+
 use Catmandu::Fix::marc_spec as => 'marc_spec';
- 
+
 my $data = { record => [...] };
- 
+
 $data = marc_spec($data,'245$a','title');
- 
+
 print $data->{title} , "\n";
 
 =head1 BUGS AND LIMITATIONS

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 95/208: Removing undef values before joining strings

2017-10-27 Thread Jonas Smedegaard
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 
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

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 78/208: Merge branch 'str_push' into dev

2017-10-27 Thread Jonas Smedegaard
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 0eb1c83cffb3b63932cbab8fe1fe721ba53621b6
Merge: 6c23104 f550805
Author: Patrick Hochstenbach 
Date:   Thu Jan 19 10:35:09 2017 +0100

Merge branch 'str_push' into dev

 lib/Catmandu/Exporter/MARC/XML.pm | 52 ---
 1 file changed, 27 insertions(+), 25 deletions(-)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 105/208: Merge branch 'broken-append' of https://github.com/jorol/Catmandu-MARC into jorol-broken-append

2017-10-27 Thread Jonas Smedegaard
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 a405bdf2a06d09f5defa00ffef43bdec07603b5b
Merge: 4000a41 c47f26b
Author: Patrick Hochstenbach 
Date:   Thu Mar 2 13:32:23 2017 +0100

Merge branch 'broken-append' of https://github.com/jorol/Catmandu-MARC into 
jorol-broken-append

 t/23-mapping_rules.t | 528 +++
 1 file changed, 528 insertions(+)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 82/208: Fixing version number of marc_spec

2017-10-27 Thread Jonas Smedegaard
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 e01d675d06eea5c0bc75cf2da1b8b060165dad83
Author: Patrick Hochstenbach 
Date:   Fri Jan 20 08:21:56 2017 +0100

Fixing version number of marc_spec
---
 lib/Catmandu/Fix/marc_spec.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Catmandu/Fix/marc_spec.pm b/lib/Catmandu/Fix/marc_spec.pm
index a2c638c..535cb76 100644
--- a/lib/Catmandu/Fix/marc_spec.pm
+++ b/lib/Catmandu/Fix/marc_spec.pm
@@ -7,7 +7,7 @@ use Catmandu::Fix::Has;
 use MARC::Spec;
 use Const::Fast;
 
-our $VERSION = '0.0.1';
+our $VERSION = '1.05';
 
 has spec   => ( fix_arg => 1 );
 has path   => ( fix_arg => 1 );

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 99/208: Starting fixing broken append

2017-10-27 Thread Jonas Smedegaard
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 6c340b556535131ce01e5687160a77e5aacc1d5e
Author: Patrick Hochstenbach 
Date:   Wed Mar 1 16:54:37 2017 +0100

Starting fixing broken append
---
 lib/Catmandu/Fix/Inline/marc_map.pm |  1 +
 lib/Catmandu/Fix/marc_map.pm| 25 ++
 lib/Catmandu/MARC.pm| 21 +---
 t/22-append-path.t  | 95 +
 4 files changed, 128 insertions(+), 14 deletions(-)

diff --git a/lib/Catmandu/Fix/Inline/marc_map.pm 
b/lib/Catmandu/Fix/Inline/marc_map.pm
index 156a0bc..095a1e0 100644
--- a/lib/Catmandu/Fix/Inline/marc_map.pm
+++ b/lib/Catmandu/Fix/Inline/marc_map.pm
@@ -74,6 +74,7 @@ sub marc_map {
 $opts{'-split'} = 0 unless exists $opts{'-split'};
 $opts{'-pluck'} = 0 unless exists $opts{'-pluck'};
 $opts{'-nested_arrays'} = 1 unless exists $opts{'-nested_arrays'};
+
 my $vals = Catmandu::MARC->instance->marc_map(
 $data,
 $marc_path,
diff --git a/lib/Catmandu/Fix/marc_map.pm b/lib/Catmandu/Fix/marc_map.pm
index 44b71a6..1b2730c 100644
--- a/lib/Catmandu/Fix/marc_map.pm
+++ b/lib/Catmandu/Fix/marc_map.pm
@@ -20,6 +20,7 @@ has nested_arrays  => (fix_opt => 1);
 sub emit {
 my ($self,$fixer) = @_;
 my $path = $fixer->split_path($self->path);
+my $key  = $path->[-1];
 my $marc_obj = Catmandu::MARC->instance;
 
 # Precompile the marc_path to gain some speed
@@ -27,31 +28,39 @@ sub emit {
 my $marc = $fixer->capture($marc_obj);
 my $marc_path= $fixer->capture($marc_context);
 my $marc_opt = $fixer->capture({
-'-join'   => $self->join   // '' ,
-'-split'  => $self->split  // 0 ,
-'-pluck'  => $self->pluck  // 0 ,
+'-join'   => $self->join   // '' ,
+'-split'  => $self->split  // 0 ,
+'-pluck'  => $self->pluck  // 0 ,
 '-nested_arrays' => $self->nested_arrays // 0 ,
-'-value'  => $self->value
+'-value'  => $self->value ,
+'-append' => $key eq '$append'
 });
-my $var  = $fixer->var;
-my $result   = $fixer->generate_var;
 
-my $perl =<var;
+my $result= $fixer->generate_var;
+my $current_value = $fixer->generate_var;
+
+my $perl = "";
+$perl .= $fixer->emit_declare_vars($current_value, "[]");
+$perl .=<marc_map(
 ${var},
 ${marc_path},
 ${marc_opt}) ) {
+${result} = ref(${result}) ? ${result} : [${result}];
+for ${current_value} (\@{${result}}) {
 EOF
 $perl .= $fixer->emit_create_path(
 $var,
 $path,
 sub {
 my $var2 = shift;
-"${var2} = ${result}"
+"${var2} = ${current_value}"
 }
 );
 
 $perl .=<{'-pluck'} // 0;
 my $value_set  = $_[3]->{'-value'} // undef;
 my $nested_arrays  = $_[3]->{'-nested_arrays'} // 0;
+my $append = $_[3]->{'-append'} // undef;
 
 my $vals;
 
@@ -134,16 +135,24 @@ sub marc_map {
 }
 }
 else {
-if (defined($vals) && ref($vals) eq '') {
-$vals = join $join_char , $vals , $v;
-}
-else {
-$vals = $v;
-}
+push @$vals , $v;
 }
 }
 }
 
+if ($split) {
+$vals = [ $vals ];
+}
+elsif ($append) {
+# we got a $append
+}
+elsif (defined $vals) {
+$vals = join $join_char , @$vals;
+}
+else {
+# no result
+}
+
 $vals;
 }
 
diff --git a/t/22-append-path.t b/t/22-append-path.t
new file mode 100644
index 000..31f111a
--- /dev/null
+++ b/t/22-append-path.t
@@ -0,0 +1,95 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use warnings qw(FATAL utf8);
+use utf8;
+
+use Test::More;
+
+use Catmandu::Importer::MARC;
+use Catmandu::Fix;
+
+note("t");
+{
+my $importer = Catmandu::Importer::MARC->new( file => 't/rug01.aleph', 
type => "ALEPHSEQ" );
+my $fixer = Catmandu::Fix->new(fixes => ['marc_map(650a,t)']);
+
+my $result = $fixer->fix($importer);
+
+my $field = $result->first->{t};
+
+ok $field , 'got an 650';

[libcatmandu-marc-perl] 87/208: Fixing POD documentation

2017-10-27 Thread Jonas Smedegaard
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 fe0afeb886554c176a02bcd9062484e175ff4b59
Author: Patrick Hochstenbach 
Date:   Mon Jan 30 16:33:10 2017 +0100

Fixing POD documentation
---
 lib/Catmandu/Exporter/MARC.pm | 32 +++---
 lib/Catmandu/Importer/MARC.pm | 45 ---
 2 files changed, 51 insertions(+), 26 deletions(-)

diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm
index b465d56..1ff43e8 100644
--- a/lib/Catmandu/Exporter/MARC.pm
+++ b/lib/Catmandu/Exporter/MARC.pm
@@ -43,7 +43,7 @@ Catmandu::Exporter::MARC - Exporter for MARC records
 $ catmandu convert MARC --type ISO to MARC --type XML < /foo/bar.mrc
 
 # From Perl
-use Catmandui -all;
+use Catmandu 'all';
 
 my $importer = importer('MARC', file => "/foo/bar.mrc" , type => 'ISO');
 my $exporter = exporter('MARC', file => "marc.xml", type => "XML" );
@@ -61,26 +61,36 @@ to a file or the standard output.
 In addition to the configuration provided by L (C,
 C, etc.) the exporter can be configured with the following parameters:
 
+The 'type' parameter describes the MARC syntax variant. Supported values 
include:
+
 =over
 
-=item type
+=item
 
-Describes the MARC syntax variant. Supported values include:
+ISO: L (default)
 
-=over
+=item
 
-=item * ISO: L (default)
+XML: L
 
-=item * XML: L
+=item
 
-=item * MARCMaker: L
+MARCMaker: L
 
-=item * MiJ: L (MARC in JSON)
+=item
 
-=item * ALEPHSEQ: L
+MiJ: L (MARC in JSON)
 
-=head1 SEE ALSO
+=item
 
-L
+ALEPHSEQ: L
 
 =back
+
+E.g.
+
+catmandu convert MARC --type XML to MARC --type ISO < marc.xml > marc.iso
+
+=head1 SEE ALSO
+
+L
diff --git a/lib/Catmandu/Importer/MARC.pm b/lib/Catmandu/Importer/MARC.pm
index 1a89307..4b9d401 100644
--- a/lib/Catmandu/Importer/MARC.pm
+++ b/lib/Catmandu/Importer/MARC.pm
@@ -62,7 +62,7 @@ Catmandu::Importer::MARC - Package that imports MARC data
 printf "title: %s\n" , $record->{title};
 });
 
-Convert MARC to JSON mapping 245a to a title with the L command line 
client:
+# Convert MARC to JSON mapping 245a to a title with the L 
command line client:
 
 catmandu convert MARC --fix "marc_map('245a','title')" < /foo/bar.mrc
 
@@ -83,7 +83,7 @@ an ARRAY of ARRAYs containing the record data
 
 =back
 
-=head2 EXAMPLE ITEM
+=head1 EXAMPLE ITEM
 
  {
 record => [
@@ -117,34 +117,49 @@ L.
 In addition to the configuration provided by L (C,
 C, etc.) the importer can be configured with the following parameters:
 
+
+The 'type' parameter describes the MARC syntax variant. Supported values 
include:
+
 =over
 
-=item type
+=item
 
-Describes the MARC syntax variant. Supported values include:
+ISO: L (default)
 
-=over
+=item
+
+MicroLIF: L
+
+=item
+
+MARCMaker: L
 
-=item * ISO: L (default)
+=item
 
-=item * MicroLIF: L
+MiJ: L (MARC in JSON)
 
-=item * MARCMaker: L
+=item
 
-=item * MiJ: L (MARC in JSON)
+XML: L
 
-=item * XML: L
+=item
 
-=item * RAW: L
+RAW: L
 
-=item * Lint: L
+=item
 
-=item * ALEPHSEQ: L
+Lint: L
+
+=item
+
+ALEPHSEQ: L
 
 =back
 
+E.g.
+
+catmandu convert MARC --type XML to MARC --type ISO < marc.xml > marc.iso
+
 =head1 SEE ALSO
 
 L
-
-=cut

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git

___
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits


[libcatmandu-marc-perl] 70/208: buffer lines before sending to IO::Handle, especially for IO::String that uses string appending

2017-10-27 Thread Jonas Smedegaard
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 d99a18ce0a488f4826b4ad4d71a35185e3d23e74
Author: Nicolas Franck 
Date:   Wed Dec 14 15:16:11 2016 +0100

buffer lines before sending to IO::Handle, especially for IO::String that 
uses string appending
---
 lib/Catmandu/Exporter/MARC/XML.pm | 52 ---
 1 file changed, 27 insertions(+), 25 deletions(-)

diff --git a/lib/Catmandu/Exporter/MARC/XML.pm 
b/lib/Catmandu/Exporter/MARC/XML.pm
index 6589681..15c054d 100644
--- a/lib/Catmandu/Exporter/MARC/XML.pm
+++ b/lib/Catmandu/Exporter/MARC/XML.pm
@@ -5,7 +5,7 @@ use Moo;
 
 our $VERSION = '1.03';
 
-with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
+with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base', 
'Catmandu::Buffer';
 
 has record   => (is => 'ro' , default => sub { 'record'});
 has record_format=> (is => 'ro' , default => sub { 'raw'} );
@@ -15,14 +15,13 @@ has xml_declaration  => (is => 'ro' , default => sub { 
1 });
 has pretty   => (is => 'rw' , default => sub { 0 });
 has _n   => (is => 'rw' , default => sub { 0 });
 
-sub _print {
+sub _line {
 my ($self, $indent, $line) = @_;
 if ($self->pretty) {
-$self->fh->print("   " x $indent);
-$self->fh->print($line);
-$self->fh->print("\n");
+my $pre = "   " x $indent;
+$self->buffer_add( $pre.$line."\n" );
 } else {
-$self->fh->print($line);
+$self->buffer_add( $line );
 }
 }
 
@@ -31,34 +30,34 @@ sub add {
 
if ($self->_n == 0) {
if ($self->xml_declaration) {
-   $self->fh->print(Catmandu::Util::xml_declaration);
+$self->buffer_add( Catmandu::Util::xml_declaration );
}
 
if ($self->collection) {
-   $self->_print(0,'http://www.loc.gov/MARC21/slim;>');
+$self->_line(0,'http://www.loc.gov/MARC21/slim;>');
}
 
$self->_n(1);
 }
- 
+
 my $indent = $self->collection ? 1 : 0;
 
-if ($self->record_format eq 'MARC-in-JSON') { 
+if ($self->record_format eq 'MARC-in-JSON') {
 $data = $self->_json_to_raw($data);
 }
 
 if ($self->collection) {
-   $self->_print($indent,'');
+$self->_line($indent,'');
 }
 else {
-   $self->_print($indent,'http://www.loc.gov/MARC21/slim;>');
+$self->_line($indent,'http://www.loc.gov/MARC21/slim;>');
 }
 
-my $record = $data->{$self->record};  
+my $record = $data->{$self->record};
 
 for my $field (@$record) {
 my ($tag, $ind1, $ind2, @data) = @$field;
-
+
 $ind1 = ' ' unless defined $ind1;
 $ind2 = ' ' unless defined $ind2;
 
@@ -68,30 +67,33 @@ sub add {
 next if @data == 0;
 
 if ($tag eq 'LDR') {
-$self->_print($indent+1,'' . xml_escape($data[1]) . 
'');
+$self->_line($indent+1,'' . xml_escape($data[1]) . 
'');
 }
 elsif ($tag =~ /^00/) {
-$self->_print($indent+1,'' . xml_escape($data[1]) . '');
+$self->_line($indent+1,'' . xml_escape($data[1]) . '');
 }
 else {
-$self->_print($indent+1,'');
+$self->_line($indent+1,'');
 while (@data) {
 my ($code, $val) = splice(@data, 0, 2);
 next unless $code =~ /[A-Za-z0-9]/;
-$self->_print($indent+2,'' 
. xml_escape($val) . '');
+$self->_line($indent+2,'' 
. xml_escape($val) . '');
 }
-$self->_print($indent+1,'');
+$self->_line($indent+1,'');
 }
 }
 
-$self->_print($indent,'');
+$self->_line($indent,'');
+
+$self->fh->print( join('', @{ $self->buffer } ) );
+$self->clear_buffer;
 }
 
 sub commit {
 my ($self) = @_;
 
 if($self->collection){
-$self->_print(0,'');
+$self->fh->print('');
 }
 
 $self->fh->flush;
@@ -106,7 +108,7 @@ Catmandu::Exporter::MARC::XML - Exporter for MARC records 
to MARCXML
 
 =head1 SYNOPSIS
 
-# From the command line 
+# From the command line
 $ catmandu convert MARC to MARC --type XML < /foo/data.mrc
 
 # From Perl
@@ -137,9 +139,9 @@ used to write to a callback function.
 Write the output to an L. If not specified,
 L is used to create the output
 handle from the C argument or by using STDOUT.
- 
+
 =item fix
- 
+
 An ARRAY of one or more fixes or file scripts to be applied to exported items.
 
 =item record
@@ -150,7 +152,7 @@ the key containing the marc record (default: 'record')
 
 Optionally set to 'MARC-in-JSON' when the input format is in MARC-in-JSON
 
-=item collection 
+=item collection
 
 add a marc:collection header when true (default: true)
 

-- 
Alioth's /usr/local/bin/git-commit-notice 

  1   2   3   >