Skip to content

Commit

Permalink
Upgrading Catmandu using new group binds for marc_each
Browse files Browse the repository at this point in the history
  • Loading branch information
phochste committed Jun 22, 2017
1 parent 4f32eea commit 18e6ade
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
10 changes: 5 additions & 5 deletions lib/Catmandu/Fix/Bind/marc_each.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ use Catmandu::Util;

our $VERSION = '1.13';

with 'Catmandu::Fix::Bind';
with 'Catmandu::Fix::Bind', 'Catmandu::Fix::Bind::Group';

has done => (is => 'ro');

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;

Expand All @@ -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};
}
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 18e6ade

Please sign in to comment.