My answer is no. As long as you do as perlsyn and the books suggest about what situation you should use a die in I think you should be fine putting the die in the subs rather than the main program. Just be sure to give a good error message chock full of info when you die - no matter where it's from.

One neat thing to look at when doing this is the caller function. This will help you spit out some interesting info about the situation when things went wrong. Also remeber to check $! (or $@ for dies from an eval) on the way out when appropriate. I like simple ones =)

"A man's maturity -- consists in having found again the seriousness on +e had as a child, at play." --Nietzsch +e

In reply to Re: Programming style question on where to use die by jptxs
in thread Programming style question on where to use die by decnartne

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.