From: Dobrica Pavlinusic Date: Sat, 2 May 2015 20:35:47 +0000 (+0200) Subject: sort leader offsets to support marc_clone X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=ebc8f9cbbc7d530b0c2b142f92e1575dcb0db4a5;p=webpac2 sort leader offsets to support marc_clone marc_clone creates full leader with offset 0, so if it ends up as last element (and order of keys is not defined) it will overwrite all other leader elements --- diff --git a/lib/WebPAC/Output/MARC.pm b/lib/WebPAC/Output/MARC.pm index cd22add..89e38fe 100644 --- a/lib/WebPAC/Output/MARC.pm +++ b/lib/WebPAC/Output/MARC.pm @@ -122,7 +122,7 @@ sub add { my $leader = $marc->leader; - foreach my $o ( keys %$new_l ) { + foreach my $o ( sort { $a <=> $b } keys %$new_l ) { my $insert = $new_l->{$o}; $leader = substr($leader, 0, $o) . $insert . substr($leader, $o+length($insert));