} elsif (m/^routes (\w+)$/) {
my $ocean= $1;
@ctx= (sub {
- m/^(\S[^\t]*\S)\t+(\S[^\t]*\S)\t+([1-9][0-9]{0,2})$/ or die;
+ m/^(\S[^\t]*\S),\s*(\S[^\t]*\S),\s*([1-9][0-9]{0,2})$/ or die;
$routes{$ocean}{$1}{$2}= $3;
});
} elsif (m/^client (\S+.*\S)$/) {
if (!$child) {
open STDIN, "<&", $tf;
&$childprep() if defined $childprep;
- exec $cmd @a; die $!;
+ exec $cmd @a; die "@a $!";
}
return $fh;
}
-sub pipethrough_run_finish ($) {
- my ($fh)= @_;
+sub pipethrough_run_finish ($$) {
+ my ($fh, $what)= @_;
$fh->error and die $!;
- close $fh or die "$! $?"; die $? if $?;
+ close $fh or die "$what $! $?"; die $? if $?;
}
sub pipethrough_run ($$$@) {
my $r;
{ undef $/; $!=0; $r= <$pt>; }
defined $r or die $!;
- pipethrough_run_finish($pt);
+ pipethrough_run_finish($pt, "@a");
return $r;
}
sub pipethrough_run_gzip ($) {
$f =~ m/^(|0|[1-9][0-9]{0,5}|\>1000)$/ or &$bad_data("bad field $i");
($i % 2) or ($f !~ m/\>/) or &$bad_data("> in field $i price");
}
+
+ foreach my $i (2,4) {
+ &$bad_data("price with no qty or vice versa (field $i)")
+ if length($v[$i]) xor length($v[$i+1]);
+ }
+ length($v[2]) or length($v[4]) or
+ &$bad_data("commodity entry with no buy or sell offer");
+
return @v;
}