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.