in reply to Error when using WWW::Mechanize
You have other issues, but this particular one is triggered here:
sub login() { $mech->get($loginPage); $mech->set_visible($email, $pass); # # the original line, below, has double quotes nested # within single quotes # #$mech->click_button('value'=>'"Sign in using our secure server"') +; # no error if you remove them $mech->click_button('value'=>'Sign in using our secure server'); }
For whatever reason, this "Can't call header.." error is what WWW:Mechanize does if you pass a value for a button that doesn't exist in the request to the click_button method. Seems like a bug to me.
Indeed..it is. click_button does not check for zero matching inputs. Until that's fixed, you can trap the error yourself:
eval {$mech->click_button('value'=>'does not exist')}; if ($@) { warn("Can't click button\n"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Error when using WWW::Mechanize
by coderman9 (Initiate) on Dec 15, 2013 at 21:34 UTC |