Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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.

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

    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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1067237]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2018-07-21 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (449 votes). Check out past polls.

    Notices?