Subject: | mech->select(value) with invalid value causes a croak in HTML::Form |
Background Info:
Linux webfileserver 2.4.18-4SGI_XFS_1.1_umask #1 Fri Nov 15 20:09:54 CET
2002 i686 unknown
This is perl, v5.8.5 built for i686-linux
# $Id: Form.pm,v 1.44 2004/06/16 10:06:07 gisle Exp $
$Header: /cvsroot/www-mechanize/www-mechanize/lib/WWW/Mechanize.pm,
v 1.129 2004/04/10 05:30:10 petdance Exp $
Attempting to mech->select with an invalid value causes HTML::Form to croak (line 440). mech->select does not check for this case before calling form->value.
#!/usr/local/bin/perl
use strict;
use CLASS;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new( autocheck => 0 );
$mech->get( $homepage );
# ...
$mech->select("mtn", $PhoneNumber ); # mtn is a valid select field in the first form,
# however $PhoneNumber is not a valid option in that form
# not reached
if (!$mech->success) {
printf "$CLASS: Could not select $PhoneNumber: " . $mech->response->status_line . "\n" ;
}
################
# Debugger output:
# Illegal value '2125551212' for field 'mtn' at /usr/local/lib/perl5/site_perl/5.8.5/WWW/Mechanize.pm line 740
# at /usr/local/lib/perl5/site_perl/5.8.5/HTML/Form.pm line 404
# HTML::Form::value('HTML::Form=HASH(0x8d97bd0)', 'mtn', 4107101652)
# called at /usr/local/lib/perl5/site_perl/5.8.5/WWW/Mechanize.pm line 740
# WWW::Mechanize::select('WWW::Mechanize=HASH(0x8aa5150)', 'mtn', 4107101652)
# called at /export/home/mmtest/lib/Verizon.pm line 98