Thanks. This got me on the right track. Simply adding a sub END { } did the trick. I had to change the ending sub to set a var, and only execute if the var wasn't set though. Waisted memory and not really the cleanest way, and I, possibly, could have put the entire ending sub in the END sub, but it works.

The original ending sub was all that needed to be executed as its basically a 'clean-up and close loose ends' function (database, file handlers, html footers, etc.).

I intentionally placed exit calls in bad places to test if all was working correctly, and it did with sub END { }, but 'failed' (because the ending sub was not executed) without it.

In reply to Re^2: Run before exit by Delusional
in thread Run before exit by Delusional

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.