I recently got a request to use carp/croak instead of warn/die in a module of mine. Since I'm going to be releasing a new version soon, now's a good time to address that request. I've sometimes used Carp, but in general found that I didn't really need the more extensive output, so I've tended to stick to warn/die . However, I'm not opposed to doing so if it is generally considered a best practice.

Unfortunately, a google/perlmonks search didn't turn up an answer. A quick glance at some of the modules distributed in core showed that some use Carp, some don't so that didn't provide a definitive answer either.

So I'll turn to you. Is it generally considered a best practice to use Carp (or conversely, is it a best practice NOT to use Carp in most cases)? Is this written down anywhere (obviously I didn't find it, but if I overlooked something, I'd like to be educated about that).


In reply to Should I use carp/croak or warn/die by SBECK

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.