X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2FCommods.pm;h=5d0ffe29fd46b8dd7b06802655b84d132ec9f100;hb=HEAD;hp=48caf79e9ba3f5ca1f0d2f158c4d8f36d18f242d;hpb=6dd8d650dfc26d113119c3566747d35855834146;p=ypp-sc-tools.web-live.git diff --git a/yarrg/Commods.pm b/yarrg/Commods.pm index 48caf79..474f43f 100644 --- a/yarrg/Commods.pm +++ b/yarrg/Commods.pm @@ -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); @@ -422,9 +424,10 @@ sub check_tsv_line ($$) { chomp($l) or &$bad_data('missing end-of-line'); - $l !~ m/\P{IsPrint}/ or &$bad_data('nonprinting char(s) '.sprintf "%#x", ord $&); + $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;