Skip to content

Commit

Permalink
Adding support for data_at in marc_add indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
phochste committed May 27, 2023
1 parent 09df6e4 commit 8a213ed
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,7 +1,8 @@
Revision history for Catmandu-MARC

{{$NEXT}}

- Fixing marc_add data_at path for indicators (obj Tiago Murakami)

1.29 2022-11-23 19:55:54 CET
- Fixing MiJ utf8 bug (obj Uldis Bojars)

Expand Down
6 changes: 3 additions & 3 deletions LICENSE
@@ -1,4 +1,4 @@
This software is copyright (c) 2022 by Patrick Hochstenbach, Carsten Klee , Johann Rolschewski.
This software is copyright (c) 2023 by Patrick Hochstenbach, Carsten Klee , Johann Rolschewski.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Expand All @@ -12,7 +12,7 @@ b) the "Artistic License"

--- The GNU General Public License, Version 1, February 1989 ---

This software is Copyright (c) 2022 by Patrick Hochstenbach, Carsten Klee , Johann Rolschewski.
This software is Copyright (c) 2023 by Patrick Hochstenbach, Carsten Klee , Johann Rolschewski.

This is free software, licensed under:

Expand Down Expand Up @@ -272,7 +272,7 @@ That's all there is to it!

--- The Artistic License 1.0 ---

This software is Copyright (c) 2022 by Patrick Hochstenbach, Carsten Klee , Johann Rolschewski.
This software is Copyright (c) 2023 by Patrick Hochstenbach, Carsten Klee , Johann Rolschewski.

This is free software, licensed under:

Expand Down
19 changes: 17 additions & 2 deletions lib/Catmandu/MARC.pm
Expand Up @@ -182,9 +182,24 @@ sub marc_add {

if ( $marc_path =~ /^\w{3}$/ ) {
my @field = ();

push @field, $marc_path;
push @field, $subfields{ind1} // ' ';
push @field, $subfields{ind2} // ' ';

my $ind1 = $subfields{ind1} // ' ';
my $ind2 = $subfields{ind2} // ' ';

if ($ind1 =~ /^\$\.(\S+)$/) {
my $path = $1;
$ind1 = Catmandu::Util::data_at( $path, $data );
}

if ($ind2 =~ /^\$\.(\S+)$/) {
my $path = $1;
$ind2 = Catmandu::Util::data_at( $path, $data );
}

push @field, $ind1;
push @field, $ind2;

for ( my $i = 0; $i < @subfields; $i += 2 ) {
my $code = $subfields[$i];
Expand Down

0 comments on commit 8a213ed

Please sign in to comment.