kodr
Programmer
- Dec 4, 2003
- 368
Help. I've got two versions of my code. The first one works as long as the remote server is reachable and fails (obviously) when the remote server is unreachable.
My second version is my attempt to capture the error and populate some error text.
My second version is my attempt to capture the error and populate some error text.
Code:
$mechanize->get($url);
my $page = $mechanize->content;
Code:
eval {$mechanize->get($url);};
if ($@) {
my $page = "Could not reach the Chicago Server!";
}
else {
# Assign the page content to $page
my $page = $mechanize->content;
}