[libcatmandu-marc-perl] 38/208: Bechmarking

Jonas Smedegaard dr at jones.dk
Sat Oct 28 03:42:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag upstream/1.19
in repository libcatmandu-marc-perl.

commit acf843fbf0366ddef888273df4cb8f97e569fe0f
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date:   Wed Jul 13 11:55:11 2016 +0200

    Bechmarking
---
 lib/Catmandu/Fix/Inline/marc_map.pm |  3 +++
 lib/Catmandu/MARC.pm                | 24 ++++++++++++------------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/lib/Catmandu/Fix/Inline/marc_map.pm b/lib/Catmandu/Fix/Inline/marc_map.pm
index fa16b51..3f32e1e 100644
--- a/lib/Catmandu/Fix/Inline/marc_map.pm
+++ b/lib/Catmandu/Fix/Inline/marc_map.pm
@@ -70,6 +70,9 @@ our $VERSION = '0.219';
 sub marc_map {
     my ($data,$marc_path,%opts) = @_;
     # Set default to nested_arrays for backwards compatibility
+    $opts{'-join'}  = ''        unless exists $opts{'-join'};
+    $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,
diff --git a/lib/Catmandu/MARC.pm b/lib/Catmandu/MARC.pm
index 22fe9f0..fe51baa 100644
--- a/lib/Catmandu/MARC.pm
+++ b/lib/Catmandu/MARC.pm
@@ -14,25 +14,25 @@ our $VERSION = '0.219';
 
 sub marc_map {
     my $self      = $_[0];
-    my $data      = $_[1];
-    my $marc_path = $_[2];
-    my $opts      = $_[3];
 
-    my $context        = ref($marc_path) ?
-                            $marc_path :
-                            $self->compile_marc_path($marc_path, subfield_wildcard => 1);
+    # $_[2] : marc_path
+    my $context        = ref($_[2]) ?
+                            $_[2] :
+                            $self->compile_marc_path($_[2], subfield_wildcard => 1);
 
     confess "invalid marc path" unless $context;
 
-    my $record         = $data->{'record'};
+    # $_[1] : data record
+    my $record         = $_[1]->{'record'};
 
     return wantarray ? () : undef unless (defined $record && ref($record) eq 'ARRAY');
 
-    my $split          = $opts->{'-split'} // 0;
-    my $join_char      = $opts->{'-join'}  // '';
-    my $pluck          = $opts->{'-pluck'} // 0;
-    my $value_set      = $opts->{'-value'};
-    my $nested_arrays  = $opts->{'-nested_arrays'} // 0;
+    # $_[3] : opts
+    my $split          = $_[3]->{'-split'} // 0;
+    my $join_char      = $_[3]->{'-join'}  // '';
+    my $pluck          = $_[3]->{'-pluck'} // 0;
+    my $value_set      = $_[3]->{'-value'} // undef;
+    my $nested_arrays  = $_[3]->{'-nested_arrays'} // 0;
 
     my $vals;
 

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



More information about the Pkg-perl-cvs-commits mailing list