Changeset 10099 in ntrip


Ignore:
Timestamp:
Jun 17, 2023, 10:56:07 PM (10 months ago)
Author:
wiese
Message:

change: toLineProtocol: sort fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/scripts/Common.pm

    r9747 r10099  
    5454    eval { mkpath($dir) };
    5555    if ($@) {
    56         warn("Could not create path [$dir]: $@");
     56        warn ("Could not create path [$dir]: $@");
    5757        return 0;
    5858    }
     
    129129                # could not replace -> append
    130130                blurt( "$newPos\n", $idxFil, { append => 1 } );
    131 #                my $INP;
    132 #                if ( !open ( $INP, ">>", $idxFil ) ) {
    133 #                    ERROR("Could not append file [$idxFil]: $!");
    134 #                    return 0;
    135 #                }
    136 #                print $INP "$newPos\n";
    137 #                close ($INP);
     131
     132                #                my $INP;
     133                #                if ( !open ( $INP, ">>", $idxFil ) ) {
     134                #                    ERROR("Could not append file [$idxFil]: $!");
     135                #                    return 0;
     136                #                }
     137                #                print $INP "$newPos\n";
     138                #                close ($INP);
    138139            }
    139140        }
     
    141142            # initial write
    142143            blurt( "$newPos\n", $idxFil );
     144
    143145            #writeTextInFile( $idxFil, "$newPos\n" );
    144146        }
     
    230232        if ( !exists $rcd->{'tags'}->{$_} ) {
    231233            $err++;
     234
    232235            #next; # ?
    233236        }
     
    238241
    239242    # Fields
    240     while ( my ( $k, $v ) = each %{ $rcd->{'fields'} } ) {
    241         if ( !defined $v ) {
     243    foreach ( sort { lc ($a) cmp lc ($b) } keys %{ $rcd->{'fields'} } ) {
     244        if ( !exists $rcd->{'fields'}->{$_} ) {
    242245            $err++;
    243         }
    244         $str .= $k . "=" . $v . ",";
     246
     247            #next; # ?
     248        }
     249        $str .= $_ . "=" . $rcd->{'fields'}->{$_} . ",";
    245250    }
    246251    chop $str;
Note: See TracChangeset for help on using the changeset viewer.