Skip to content
Snippets Groups Projects
Commit 7f25f058 authored by Jens Steidl's avatar Jens Steidl :baby_chick:
Browse files

- updated/added parameter checks

parent 02c9b413
No related branches found
No related tags found
No related merge requests found
...@@ -96,7 +96,7 @@ package SLUB::LZA::SIPBuilderBagIt; ...@@ -96,7 +96,7 @@ package SLUB::LZA::SIPBuilderBagIt;
]; ];
sub add_metadata($$$$) { sub add_metadata($$$$) {
if(! defined $_[0]) { croak "array of hashes not defined for bag-info.txt!"; } if(ref($_[0]) ne 'ARRAY') { croak "array of hashes not defined for bag-info.txt!"; }
my $refAddBagInfo = $_[0]; # ref to array of hashes my $refAddBagInfo = $_[0]; # ref to array of hashes
my $ppn = $_[1]; my $ppn = $_[1];
...@@ -116,6 +116,9 @@ package SLUB::LZA::SIPBuilderBagIt; ...@@ -116,6 +116,9 @@ package SLUB::LZA::SIPBuilderBagIt;
} }
sub get_marc21_text_node($$) { sub get_marc21_text_node($$) {
if(! $_[0]) { croak "empty marc21!"; }
if(ref($_[1]) ne 'HASH') { croak "not a mapping hash!"; }
my $marc21 = $_[0]; my $marc21 = $_[0];
my $mapping = $_[1]; my $mapping = $_[1];
...@@ -130,9 +133,9 @@ package SLUB::LZA::SIPBuilderBagIt; ...@@ -130,9 +133,9 @@ package SLUB::LZA::SIPBuilderBagIt;
} }
sub get_marc21_from_catalogue($){ sub get_marc21_from_catalogue($){
if(! defined $_[0]){ croak "ppn not defined!"; } if(! $_[0]){ croak "ppn not defined!"; }
my $ppn = shift; my $ppn = $_[0];
my $marc21; my $marc21;
my $use_fallback; my $use_fallback;
...@@ -678,7 +681,10 @@ PATCH ...@@ -678,7 +681,10 @@ PATCH
} }
sub checkForTitle($){ sub checkForTitle($){
my $key_hash_list_aref = shift; if(ref($_[0]) ne 'ARRAY') { croak "no array of hashes with bag-info.txt key values given!"; }
my $key_hash_list_aref = $_[0];
# collect all bag-info keys for easy check # collect all bag-info keys for easy check
my @keys; my @keys;
for my $hash (@{$key_hash_list_aref}) { for my $hash (@{$key_hash_list_aref}) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment