3 ms·
I'm not going to count eval(...) as exception handling as a language feature in Perl 5. :) You should. It's a perfectly valid exception handling mechanism. It'
by chromatic 7y ago
I'm not going to count eval(...) as exception handling as a language feature in Perl 5. :)
You should. It's a perfectly valid exception handling mechanism. It's unfortunate that the name "eval" is overloaded for two separate behaviors:
* catch exceptions thrown as strings or objects
* compile and execute code from a string
Other than the name, they're different behaviors.
- mey 7y agoI am not a Perl expert. Only worked on some simple install tools written it a couple years ago. Re-reading docs, eval(...) traps exceptions (die), but requires manual inspection of error state, instead of automatically halting. It operates more like Go/C/PHP in that regard.