chiark / gitweb /
Properly reject capacity strings which start with a commodity
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 21 Sep 2009 17:04:51 +0000 (18:04 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 21 Sep 2009 17:04:51 +0000 (18:04 +0100)
yarrg/web/check_capacitystring

index 3c77972..a79b6f1 100644 (file)
@@ -88,6 +88,9 @@ my $parse_values= sub {
        elsif (s/^( $iqtyrex ) \s* ([a-z ]+) \s+ //xo) {
                my ($qty,$spec) = ($1,$2);
                $debugf->("VALUE COMMOD $qty '$spec'");
        elsif (s/^( $iqtyrex ) \s* ([a-z ]+) \s+ //xo) {
                my ($qty,$spec) = ($1,$2);
                $debugf->("VALUE COMMOD $qty '$spec'");
+               expected_error("Capacity specification must start with".
+                              " ship size or amount with units")
+                       if $first_term;
                $commodsth ||=
                    $dbh->prepare("SELECT commodname,unitmass,unitvolume
                                     FROM commods WHERE commodname LIKE ?");
                $commodsth ||=
                    $dbh->prepare("SELECT commodname,unitmass,unitvolume
                                     FROM commods WHERE commodname LIKE ?");