http://www.perlmonks.org?node_id=863611


in reply to Re^12: eval to replace die?
in thread eval to replace die?

Not to mention the fact that exception objects can carry optional stack traces and various other information, which makes them even more valuable to the user, even if it's just to communicate a better description of the error to a developer.

Have you heard of Carp::Croak()?

If you really think $foo eq "bar" and $foo->isa('Something') are exactly the same, I'm quite concerned.

If you think that $foo eq 'Something' and $foo->isa( 'Something' ) are vastly different...you should be concerned.

The bottom line is, either technique requires programmer discipline. If you really used 'MyError' for your exception namespace, you are just as vulnerable to someone else choosing that badly chosen namespace for their exceptions, as I would be if I used a non-specific formating convention for my error messages.

If programmers adhere to a standard for their errors or exceptions, the problems are alleviated.

But exceptions are not a magic bullet that will fix badly architected code.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.