I have a Perl script that will interrogate 400 domains. Occasionally a domain is not online, causing the program to die. Can I amend the program to not die, but resume the next domain in the array?
$query = "SELECT DISTINCT a.url FROM links_current a LEFT JOIN links_a +rchive b ON a.url = b.url WHERE b.url IS NULL ;"; $statement = $dbh->prepare($query) or error ("Cannot Prepare Select li +nks_current Statement: " . $dbh->errstr()); $statement->execute() or error ("Cannot Execute Select Distinct links_ +current Statement: " . $dbh->errstr()); my $arraycount = $statement->rows; # Fetch Each New Link (Record) Not Previous Archived Inside The Databa +se my $counter = 1; while (my $website = $statement->fetchrow_array()){ $mech->get($website)
or error ("Cannot Connect To Website $website: " . $statement->errstr());
$counter++; archive_article($title, $article, $website); archive_link($website); }

In reply to Mechanize, Do Not Die, Do Next In Loop by douglazb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.