To answer the second part of your question: you shouldn't return to the try block once an exception has been thrown. The exception indicates that some abnormal condition has occured (say for instance, a file couldn't be opened), so the rest of the code in the try block should not be executed since it would lead to unpredictable behaviour or simply crash the program.

Just my 2 cents, -gjb-

Update: As to dragonchild's remark below: in such a case it's cleaner to work with a finer granularity for the try/catch. I.e. if the caller doesn't consider the exception an error, only the statement generating it should be put in the try/catch construct, no other statements that can be executed regardless of the nature of the exception or after the catch block has done some recovery.


In reply to Re: Error module by gjb
in thread Error module by hotshot

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.