WWW-Mechanize - Re: Preventing WWW::Mechanize from aborting the whole script

Posted on Mon Mar 6 14:56:33 2006 by cjaramilu in response to 1900 (See the whole thread of 5)
Re: Preventing WWW::Mechanize from aborting the whole script
Other suggestion:
You can catch the error without aborting the script
by wrapping the submit_form imside an eval block.
eval { $mech->submit_form ( form_number => 1 , fields => { foo => "bar" } ); }; if ( $@ ) { # error print "error ($@) "; } else { # success $c = $mech->content; print $c; }
Direct Responses: 1905 | Write a response