Thanks very much. Error looks useful for error handling... I think that's a secondary concern for me, though.

The big issue, I think (I'm still working on understanding what the crux of the problem is myself), is how to go back to a previous step.

For instance, if my program proceeds like this:

## Step 1 go_to_web_page_A(); ## Step 2 look_for_stuff_on_web_page_A(); ## Step 3 submit_form_on_A_to_go_to_B();

and it dies on step 2, that's almost always because step 1 failed. That is, it can't find the stuff it's looking for because the web page failed to load correctly.

So what I want to do is catch the failure of look_for_stuff_on_web_page_A() and, in case of a failure, retry go_to_web_page_A(); and then look_for_stuff_on_web_page_A(); a couple times before finally giving up.

Basically what it's doing is "Do A; Do B; If B fails, go back and do A again and then retry B;", and the part I'm having trouble with is the "If B fails, go back to A" part.

Any thoughts?


In reply to Re^2: catching failures and retrying by mickey
in thread catching failures and retrying by mickey

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.