Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Error when using WWW::Mechanize

by kschwab (Priest)
on Dec 15, 2013 at 15:16 UTC ( #1067237=note: print w/replies, xml ) Need Help??

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. 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

    Thanks a bunch. When reading the source code of the page I forgot that they would be using quotation marks also, so I was thinking that the value had the quotation marks in it. Thanks

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1067237]
and the monks are mute...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-03-23 01:34 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (287 votes). Check out past polls.