Subject: | patch: better error message for illegal values |
Hello,
Here's a small patch for HTML::Form. I was using it as part of WWW::Mechanize::Shell and was getting back an error:
"illegal value: 2"
The form I was working was huge, and I had no idea which field was causing the problem.
This simple patch returns the troublesome field name along with the illegal value, making it much easier to identify.
--- /sw/lib/perl5/site_perl/5.8.0/HTML/Form.pm.orig Wed Jun 4 10:48:55 2003
+++ /sw/lib/perl5/site_perl/5.8.0/HTML/Form.pm Wed Jun 4 10:51:34 2003
@@ -754,7 +754,7 @@
}
$i++;
}
- Carp::croak("Illegal value '$val'") unless defined $cur;
+ Carp::croak($self->name." has illegal value '$val'") unless defined $cur;
$self->{current} = $cur;
$self->{seen}[$cur] = 1;
}