A i see what you mean now by 'testing a croak without die'.
BrowserUk is right, but i do not like it, for 2 reasons.

1. I don't like eval.
Eval creates major security issues if improper used. (and that happens fast). But you're using it for testing, so that won't probably stop you here.
2. I don't like die
A script that dies with an error is not my kind of taste. I'd better like to use carp or cluck, and give a warning to the user, but definately not die. (Especially for webbased applications, where they give nasty server-errors)

*Update* I really don't understand the 'big' discussion that comes up now. I never stated that i BrowserUk was wrong, i said he is right.
I only stated that i (me myself and i), don't like it, that is not stating that i never use it, or that it should not be used at all.
I gave 2 reasons (you can agree with or not) why, and IMHO, correct reasons.
I mainly work in web applications, most of the time a simple warn is enough to create the proper logs i need.
Next, the use of eval can be dangerous, that's what i point out, not that it allways is, and yes i use eval as well.

Next, i NEVER EVER stated that my programs are perfect (in fact, they're far from perfect, like most programs are).

I've got a slight feeling here that there is a bit overreacting here on something that was stated as my own opinion.
"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

In reply to Re^2: testing a croak by jbrugger
in thread testing a croak by arcnon

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.