Skip to content
Snippets Groups Projects
Commit 70a219d9 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- changed order in if-elsif-else to handle most frequent case first

parent 12d026cf
No related branches found
No related tags found
No related merge requests found
......@@ -324,15 +324,10 @@ sub check_if_db_conform ($$) {
my $repids = $xp->find($compiled_xpath_amdsecs); #/mets:mets/mets:amdSec
my $repid;
my @repnodes = $repids->get_nodelist;
if (scalar @repnodes == 0) {
say STDERR "No reppid found in file $filename, is IE purged?";
my %tmp;
$tmp{"filename"}=$filename;
$tmp{"purged"}=1;
return \%tmp;
} elsif (scalar @repnodes == 1) {
my $found = scalar @repnodes;
if (1 == $found) {
$repid = $repnodes[0]->findvalue($compiled_xpath_id);
} else { #multiple representations found
} elsif ($found > 1) { #multiple representations found
# choose reppid with LZA, LZA_INTERN or LOCAL (for very old IEs)
foreach my $node (@repnodes) {
my $id = $node->findvalue($compiled_xpath_id);
......@@ -348,6 +343,12 @@ sub check_if_db_conform ($$) {
}
#print XML::XPath::XMLParser::as_string($node), "\n\n";
}
} elsif (0 == $found) {
say STDERR "No reppid found in file $filename, is IE purged?";
my %tmp;
$tmp{"filename"}=$filename;
$tmp{"purged"}=1;
return \%tmp;
}
if (!defined $repid) {
say "No repid found in file $filename";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment