Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Crashing WWW:Mech test script if page not found

by tomfahle (Priest)
on Jan 03, 2009 at 11:38 UTC ( #733900=note: print w/ replies, xml ) Need Help??


in reply to Crashing WWW:Mech test script if page not found

As mentioned by others before, turn off autocheck.

#!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $browser = WWW::Mechanize->new( stack_depth => 0, # Turn off memory consuming history timeout => 180, # Set timeout in seconds autocheck => 0, # Turn off autocheck, check errors m +anually ); $browser->agent_alias( 'Windows IE 6' ); my $url = 'https://foo.bar/page.html'; $browser->get($url); if ( $browser->success( ) ) { print "Okay: $url. ", $browser->response->status_line(), "\n"; } else { print "Error: $url. Reason: ", $browser->response->status_line(), +"\n"; }

Run the script with autocheck turned on (1) to reproduce your errormessage.

Hope this helps.
Thomas


Comment on Re: Crashing WWW:Mech test script if page not found
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://733900]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2014-09-02 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (18 votes), past polls