I have the following code to check the website status.

my $ua = LWP::UserAgent->new;
$url = "http://www.cnn.com";;
$response = $ua->get($url);
if ($response->is_success) {
        print "web site is working\n";
} else { 
        print "web site is not working\n";
}

quesion:
1) if the site is not woring, I would like to know why ?. How can I retrieve
the error code?
2) what is the fail value ? i.e. $response->not_working.. etc.

Thanks

Reply via email to