X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=blobdiff_plain;f=yarrg%2FCommods.pm;h=dff539d87166a7e3b7e114d6a0d9d68be6c0f06c;hp=13f581241fa1bd770e166e7e1cf4e581e36c473c;hb=2cf70baa979e0c460e4e46a9c1a53677b09a1972;hpb=5c4f4ea818dd0947a4ef28baa6f85d817f0aca44 diff --git a/yarrg/Commods.pm b/yarrg/Commods.pm index 13f5812..dff539d 100644 --- a/yarrg/Commods.pm +++ b/yarrg/Commods.pm @@ -122,13 +122,13 @@ sub parse_info1 ($$) { #print "ca($s)\n"; if ($s !~ m/\%(\w+)/) { my ($name, $props) = $s =~ - /^(\S[^\t]*\S)\t+(\S[^\t]*\S)$/ + /^(\S[^\t]*\S)(?:\t+(\S[^\t]*\S))?$/ or die "bad commodspec $s"; my $ucname= ucfirst $name; $commods{$ucname}{Srcs} .= $ss; my $c= $commods{$ucname}; $c->{Volume}= 1000; - foreach my $prop (split /\s+/, $props) { + foreach my $prop (defined $props ? split /\s+/, $props : ()) { if ($prop =~ m/^([1-9]\d*)(k?)g$/) { $c->{Mass}= $1 * ($2 ? 1000 : 1); } elsif ($prop =~m/^([1-9]\d*)l$/) { @@ -137,7 +137,6 @@ sub parse_info1 ($$) { die "unknown property $prop for $ucname"; } } - die "no mass for $ucname" unless defined $c->{Mass}; return; } die "unknown $&" unless defined $colours{$1}; @@ -257,6 +256,7 @@ sub pipethrough_prep () { sub pipethrough_run_along ($$$@) { my ($tf, $childprep, $cmd, @a) = @_; + $tf->error and die $!; $tf->flush or die $!; $tf->seek(0,0) or die $!; my $fh= new IO::File;