chiark / gitweb /
Improve message slightly
[ypp-sc-tools.db-live.git] / yarrg / Commods.pm
index 13f581241fa1bd770e166e7e1cf4e581e36c473c..dff539d87166a7e3b7e114d6a0d9d68be6c0f06c 100644 (file)
@@ -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;