summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-04-07 09:43:57 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-04-07 09:43:57 +0200
commit9abfcfa3dc389001d9c5a2f8a95b17bf3fbad5c8 (patch)
tree49d249c43fc4742135be08bf66bd31518c2377e4 /bin
parent7ee990debb0a75c45c02a82b1fdf34691f945da4 (diff)
efa: Show possible alternatives when receiving ambiguous input
Diffstat (limited to 'bin')
-rwxr-xr-xbin/efa16
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/efa b/bin/efa
index be2b29c..7d0b7d9 100755
--- a/bin/efa
+++ b/bin/efa
@@ -90,7 +90,21 @@ $www->submit_form(
$content = $www->content;
-foreach(split(/<span class="labelTextBold"> \d+\. Fahrt<\/span>/, $content)) {
+# ambiguous input
+if ($content =~ /<span class="errorTextBold">Bitte auswählen<\/span>/s) {
+ print STDERR "Ambiguous input for ";
+ if ($content =~ /<select name="(?<what>(place|type|name)_(origin|destination))"/) {
+ print STDERR "$+{what}\n";
+ } else {
+ print STDERR "unknown\n";
+ }
+ while ($content =~ /<option value="\d+:\d+"( selected)?>(?<choice>[^<]+)<\/option>/gs) {
+ print STDERR "\t$+{choice}\n";
+ }
+ exit(1);
+}
+
+foreach (split(/<span class="labelTextBold"> \d+\. Fahrt<\/span>/, $content)) {
unless ($offer) {
$offer++;
next;