Avoid numeric comparisons with leading zeroes

Numbers in perl with leading zeros are interpreted in octal
Ensure that comparisons are done using string operators
or where appropriate use the MARC::Field method

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
Colin Campbell 2009-08-20 11:12:57 +01:00 committed by Galen Charlton
parent b94e7acbbc
commit 3199d032e5
4 changed files with 4 additions and 4 deletions

View File

@ -381,7 +381,7 @@ sub html2marcxml {
$marcxml.="<leader>@$values[$i]</leader>\n";
$first=1;
# rest of the fixed fields
} elsif (@$tags[$i] < 010) { #FIXME: <10 was the way it was, there might even be a better way
} elsif (@$tags[$i] lt '010') { # don't compare numerically 010 == 8
$marcxml.="<controlfield tag=\"@$tags[$i]\">@$values[$i]</controlfield>\n";
$first=1;
} else {

View File

@ -665,7 +665,7 @@ sub build_tabs ($$$$$) {
fixedfield => $tag < 10?1:0,
random => CreateKey,
);
if ($tag >= 010){ # no indicator for theses tag
if ($tag >= 10){ # no indicator for 00x tags
$tag_data{indicator1} = format_indicator($field->indicator(1)),
$tag_data{indicator2} = format_indicator($field->indicator(2)),
}

View File

@ -69,7 +69,7 @@ my $i=0;
while ( my $record = $batch->next() ) {
$i++;
foreach my $MARCfield ($record->fields()) {
next if $MARCfield->tag()<=010;
next if $MARCfield->is_control_field(); # tag num < 10
if ($MARCfield) {
foreach my $fields ($MARCfield->subfields()) {
if ($fields) {

View File

@ -195,7 +195,7 @@ RECORD: while ( ) {
next RECORD;
}
if (defined $idmapfl) {
if ($sourcetag < "010"){
if ($sourcetag lt '010'){
if ($record->field($sourcetag)){
my $source = $record->field($sourcetag)->data();
printf(IDMAP "%s|%s\n",$source,$biblionumber);