X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=pctb%2FCommods.pm;h=183eb9655607aaa5044d28c25b7c30e7e8241925;hb=6545361893dec0aa124ca153d20d1cce64e0e573;hp=75d48c4ee9d2ed707d4da20268274cdbfe474546;hpb=e3bd945bfba693d7467f28a2c59e77219387caa9;p=ypp-sc-tools.main.git diff --git a/pctb/Commods.pm b/pctb/Commods.pm index 75d48c4..183eb96 100644 --- a/pctb/Commods.pm +++ b/pctb/Commods.pm @@ -84,7 +84,7 @@ sub parse_master_master1 ($$) { } 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)$/) { @@ -292,6 +292,14 @@ sub check_tsv_line ($$) { $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; }