chiark / gitweb /
tolerate stalls whose names don't start with alphanumerics
[ypp-sc-tools.db-live.git] / yarrg / Commods.pm
index 42670342372f8dfbc20f24d063e74d796c041f4b..7f4061048c5e7360c4be9a62197d13d335ee76ff 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);
@@ -422,7 +424,7 @@ sub check_tsv_line ($$) {
     
     chomp($l) or &$bad_data('missing end-of-line');
 
-    $l !~ m/\P{IsPrint}/ or &$bad_data('nonprinting char(s)');
+    $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[1] =~ s/^\s+//; $v[1] =~ s/\s+$//; # ooo don't check :-(
@@ -432,8 +434,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;