chiark / gitweb /
Normalise commodity name case (from uploads) master t origin/master
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Apr 2023 12:20:08 +0000 (13:20 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Apr 2023 12:23:41 +0000 (13:23 +0100)
13 files changed:
yarrg/Commods.pm
yarrg/commod-email-processor
yarrg/commod-results-processor
yarrg/commod-update-receiver
yarrg/database-info-fetch
yarrg/db-idempotent-populate
yarrg/decode-pctb-marketdata
yarrg/dictionary-update-receiver
yarrg/ocean-topology-graph
yarrg/source-info.txt
yarrg/update-master-info
yarrg/web/autohandler
yarrg/web/query_routesearch

index 5d0ffe29fd46b8dd7b06802655b84d132ec9f100..474f43fb86ba3734dc0171331656383a592aca17 100644 (file)
@@ -30,6 +30,8 @@ use LWP::UserAgent;
 use strict;
 use warnings;
 
+no warnings qw(exec);
+
 BEGIN {
     use Exporter ();
     our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
@@ -425,6 +427,7 @@ sub check_tsv_line ($$) {
     $l =~ m/[\t [:graph:]]/ or &$bad_data('nonprinting char(s) '.sprintf "%#x", ord $&);
     my @v= split /\t/, $l, -1;
     @v==6 or &$bad_data('wrong number of fields');
+    $v[0] = ucfirst lc $v[0]; # YPP anomalously has "Rum Spice"
     $v[1] =~ s/^\s+//; $v[1] =~ s/\s+$//; # ooo don't check :-(
     my ($commod,$stall) = @v;
 
@@ -432,8 +435,8 @@ sub check_tsv_line ($$) {
        defined $commods{$commod} or
        &$bad_data("unknown commodity ".errsan($commod));
     
-    $stall =~ m/^\p{IsAlnum}/ or
-       &$bad_data("stall does not start with alphanumeric ".errsan($stall));
+    $stall =~ m/\p{IsAlnum}/ or
+       &$bad_data("stall does not contain with alphanumeric".errsan($stall));
     !exists $check_tsv_done{$commod,$stall} or
        &$bad_data("repeated data ".errsan($commod).",".errsan($stall));
     $check_tsv_done{$commod,$stall}= 1;
index e65b2b6a91fcfe2237f6d8c123e0891a0ec5cebd..ff0880e9c876d6f14118d38c00149130de511f18 100755 (executable)
@@ -34,6 +34,8 @@ BEGIN {
     my $selfdir= $0;
     $selfdir =~ s,/+[^/]*$,,;
     chdir("$selfdir") or die "$selfdir $!";
+
+    unshift @INC, qw(.);
 }
 
 use Commods;
index d427f74b41d10a51bcc2ed8fee3ae525a78e2fc2..fe05fb8722c207acb14c44f63d0d15b31a20bf17 100755 (executable)
@@ -24,6 +24,7 @@
 # are used without permission.  This program is not endorsed or
 # sponsored by Three Rings.
 
+BEGIN { unshift @INC, qw(.) }
 
 use strict (qw(vars));
 use HTTP::Request;
index 2059ad792416710584c279eb1d2de63032220339..0258a51e04130c96ff24a3151095132dbfc3faee 100755 (executable)
 # are used without permission.  This program is not endorsed or
 # sponsored by Three Rings.
 
+BEGIN { unshift @INC, qw(.) }
+
 use strict (qw(vars));
 use POSIX;
 use MIME::Entity;
 
 use Commods;
 
+no warnings qw(exec);
+
 $CGI::POST_MAX= 3*1024*1024;
 
 use CGI qw/:standard -private_tempfiles/;
index 041e008f4220e0a775c8ce4aeab18f5c7d4535ff..655d2ecdb05871502eed20e102476b0e4e80b274 100755 (executable)
@@ -24,6 +24,8 @@
 # are used without permission.  This program is not endorsed or
 # sponsored by Three Rings.
 
+BEGIN { unshift @INC, qw(.) }
+
 use strict (qw(vars));
 use JSON;
 #use Data::Dumper;
index eb1a30b43a581047e330b4f226670083366e3fb0..2b63f2b9b110f0b334c2fafade4eeba24c6380e3 100755 (executable)
@@ -29,6 +29,8 @@
 # are used without permission.  This program is not endorsed or
 # sponsored by Three Rings.
 
+BEGIN { unshift @INC, qw(.) }
+
 use strict (qw(vars));
 
 use DBI;
index df8203c47905a85df290933f4505e6aa3e0ff9a6..d3f4a4e287df0591352159ef15ba363760c849e2 100755 (executable)
@@ -3,6 +3,8 @@
 # This specific file is hereby placed in the public domain, or nearest
 # equivalent in law, by me, Ian Jackson.  5th July 2009.
 
+BEGIN { unshift @INC, qw(.) }
+
 use IO::File;
 use strict (qw(vars));
 
index 3baef669ddf6b4eefcc7a7942cb709118a9fc9dc..feef04b641e23a2ccbfa04a309f8a9dafd42ccce 100755 (executable)
 # YPPSC_YARRG_DICT_UPDATE=./ YPPSC_YARRG_DICT_SUBMIT=./ ./yarrg --ocean midnight --pirate aristarchus --find-island --same --raw-tsv >raw.tsv  
 # ./dictionary-manager --debug --approve-updates '' . .
 
+BEGIN { unshift @INC, qw(.) }
+
 use strict (qw(vars));
 use POSIX;
 
+no warnings qw(exec);
+
 $CGI::POST_MAX= 1024*1024;
 $CGI::DISABLE_UPLOADS= 1;
 
index 2336b43c453a717363049a18e4132cecd14b5293..e234189c53986745c27f96375d781eb8cbea282a 100755 (executable)
@@ -22,6 +22,8 @@
 # are used without permission.  This program is not endorsed or
 # sponsored by Three Rings.
 
+BEGIN { unshift @INC, qw(.) }
+
 use strict (qw(vars));
 
 use CommodsDatabase;
index eb3e7d2c26926f1747f62dee2f9d0a62f149323f..e160fcbad6631d004b6f9845ca30121b095738ee 100644 (file)
@@ -45,6 +45,19 @@ commodclasses
  *enamel
  *forageables
 
+# Commodities are defined in `commods` sections
+# Each line is
+#  <name> <facts>
+# and the <facts> can be
+#  <mass>kg
+#  <volume>l
+#  *<class> (see commodclasses, above)
+#  @<sort-number>    sort order value, for where in the commods list it goes
+#  @<sort-number>+   sort order value; 10x line number is added
+# The <name> can contain `%<reference>` which is then defined in
+# a `%<reference>` section.
+# Volume defaults to 1l.
+
 commods
  kraken's blood                1kg             *dye                    @105
  %d dye                        1kg             *dye                    @0
@@ -149,6 +162,7 @@ commods
  swill                 1kg             *ship_supplies          @0+
  grog                  1kg             *ship_supplies          @0+
  fine rum              1kg             *ship_supplies          @0+
+ rum spice             800g            *ship_supplies          @0+
  small cannon balls    7100g           *ship_supplies          @0+
  medium cannon balls   14200g 2l       *ship_supplies          @0+
  large cannon balls    21300g 3l       *ship_supplies          @0+
@@ -169,6 +183,7 @@ commods
  lily of the valley    300g            *herbs                  @0+
  nettle                        300g            *herbs                  @0+
  butterfly weed                100g            *herbs                  @0+
+ allspice              800g            *herbs                  @0+
 
  bananas               125kg 100l      *forageables            @300000+
  carambolas            125kg 100l      *forageables            @300000+
@@ -259,3 +274,8 @@ ocean Ice
   Winking Wall Island
 
 ocean Obsidian
+ Ye Bloody Bounding Main
+  Loggerhead Island
+  Melanaster Island
+  Picklepine Ridge
+  Woodtick Island
index adad34c81f42fbd29dbc2d0f9b24a7a392bda272..797eb9da52706a1cc44bbb5a3915a955387f20df 100755 (executable)
@@ -52,6 +52,8 @@
 # are used without permission.  This program is not endorsed or
 # sponsored by Three Rings.
 
+BEGIN { unshift @INC, qw(.) }
+
 use strict (qw(vars));
 use DBI;
 use Commods;
index 8ff09966b953143dfd474a4a0d43c66913f47c38..64e31fc9a66c93dc0ec7d4d362e96064fc576e4b 100644 (file)
@@ -35,6 +35,8 @@
 
 </%doc><%perl>
 
+no warnings qw(exec);
+
 use CommodsWeb;
 
 my $printable= printable($m);
index 151824cdec7a8a77db75f0b6b1c0c1055a0da2fa..126c4e804d860a807d5abfb57b5dd36dd66a728c 100644 (file)
@@ -51,6 +51,8 @@ $allargs
 </%args>
 
 <%perl>
+no warnings qw(exec);
+
 use BSD::Resource;
 
 my $emsg;