I like the less convoluted and most flexible solution. I use Carp::cluck and Carp::confess a lot during development, switching later to warn and die.

There are cases in which croak reports wrong line numbers. I generally prefer modules which use just warn and don't die, because die in a module leads to evalitis.

I would rather see warn in modules, because I can override that easily with a $SIG{__WARN__} = \&Carp::cluck, and don't have to redefine Carp::croak.

I have stumbled over a very nasty usage of croak in the IO::All module, which wraps croak into a function called throw(). Took me some time wondering, and searching through the module to find out why my __DIE__ handler didn't work. I ended up redefining IO::All::throw with a custom function.

So, I wouldn't make the change, but answer to the ticket issuer "You can always install your custom handlers via $SIG{__WARN__} and $SIG{__DIE__}" and leave it there.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re: Replacing warn/die with carp/croak? by shmem
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.