My modules aren't in CPAN (I guess one of these days, I should release 'em, but there's less than 10 people who seem to be searching for solar physics data and were interested in installing the software so far), but I'd have to say that I use both carp and warn. I _rarely_ use croak or die.

Basically, if we were to think of it as the difference in a webserver throwing a 500 level error vs. a 400 level error -- was this something wrong with _this_ code, or was it somethig wrong with the code that called this code?

So, if bad arguments were passed in, I use carp. If I hit a branch of logic that seems like something went wrong with my code, I use warn (in extreme cases, die, but they're typically reserved for major problems, like someone not defining required functions when inheriting an abstract class ).


In reply to Re: Replacing warn/die with carp/croak? by jhourcle
in thread Replacing warn/die with carp/croak? by dragonchild

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.