A programming idiom, common in PerlLanguage, CeeLanguage, and other Unix scripting languages (BourneShell, CeeShell) used for error handling.
The idiom is essentially to write code such as the following:
take_some_action() || handle_the_error();In PerlLanguage, the way errors are often handled is to throw an exception using Perl's die command, hence DoOrDie. In PHP, the code looks like this:
DoSomething?() or die("Something failed");This relies on two things:
One can do similar stuff with boolean AND to chain operations, ensuring that subsequent operations are only run if their predecessor succeeded.
I'm not normally against exceptions, but in Perl's case the primitive implementation really kills the utility. Making a %SIG{__DIE__} handler useful can be quite a pain. -PA
Why can't you use eval {}?
Perl 5's eval {...};if ($@) {...} is other languages try's equivalent
- Pawel Murias
Topic not to be confused with LimpVersusDie.