Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: catch errors using Mechanize

by chanakya (Friar)
on May 17, 2005 at 05:26 UTC ( [id://457670]=note: print w/replies, xml ) Need Help??


in reply to catch errors using Mechanize

snaporaz, here's the code I've used with WWW::Mechanize, without using eval
#!/usr/bin/env perl5.8.6 use strict; use warnings; use WWW::Mechanize; use WWW::Mechanize::FormFiller; my $mech = WWW::Mechanize->new(); my $formfiller = WWW::Mechanize::FormFiller->new(); ## Grab the home page, $mech->get("http://someurl"); my $msg= <<EOF; Couldn't get the xxxx portal. EOF #If not success, send mail and print the response output $mech->success or die send_mail("Subject: xxxx Portal down", $msg_b +os) , $mech->response->status_line; ## Store new HTML content in a temporary file and open it for viewing +. open (OUT,">/tmp/login.results"); print OUT $mech->content(); close (OUT); exit(0);
!!@!!
May the force be with you

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-20 03:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found