IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 10, 2010, 10:54:45 AM (16 years ago)
Author:
bills
Message:

use parse_md_fast to read request file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm

    r27783 r27900  
    145145        }
    146146        if (@$stdout_buf) {
    147             my $table =  $mdcParser->parse(join "", @$stdout_buf) or
    148                 die("Unable to parse metdata config doc");
    149 
    150             $rows = parse_md_list($table);
     147            $rows = parse_md_fast($mdcParser, join "", @$stdout_buf);
    151148        } else {
    152149            print STDERR "$request_file_name contains empty request table\n";
     
    180177    return (\%header, \%req_specs);
    181178}
     179
     180sub parse_md_fast {
     181    my $mdcParser = shift;
     182    my $input = shift;
     183    my $output = ();
     184
     185    my @whole = split /\n/, $input;
     186    my @single = ();
     187
     188    my $n;
     189    while ( ($n = @whole) > 0) {
     190        my $value = shift @whole;
     191        push @single, $value;
     192        if ($value =~ /^\s*END\s*$/) {
     193            push @single, "\n";
     194
     195            my $list = parse_md_list( $mdcParser->parse( join("\n", @single ) ) ) or
     196                print STDERR "Unable to parse metdata config doc" and return undef;
     197#            my $num = @$list;
     198#            print STDERR "list has $num elments\n";
     199            push @$output, $list->[0];
     200
     201            @single = ();
     202        }
     203    }
     204    return $output;
     205}
     206
    1822071;
Note: See TracChangeset for help on using the changeset viewer.