switch (ref $@) { OverflowError => warn 'Dam needs to be drained'; DomainError => warn 'King needs to be trained'; NuclearWarError => die; }
About this quote
- What does it mean?
- A code snippet shows handling different error types with warnings or termination.
- In plain terms
- The program catches specific errors and either warns or aborts.
- What can you take from it?
- Map each error to an appropriate response.
Where it applies
Putting it to work
Questions to consider
- How does granular error handling improve software stability?
Another view
The example uses humor (e.g., NuclearWarError) that may distract from the point.
More from Larry Wall
This has been planned for some time. I guess we'll just have to find someone with an exceptionally round tuit.
Permalink to quote #128 I surely do hope that's a syntax error.
Permalink to quote #130 I wasn't recommending that we make the links for them, only provide them with the tools to do so if they want to take the gamble (or the gambol).
Permalink to quote #127
Related quotes
A programming language is for thinking of programs, not for expressing programs you've already thought of.
Paul GrahamPaul Graham quote #10 My programming language was solder.
Terry PratchettTerry Pratchett quote #2 That's the thing about people who think they hate computers ... What they really hate are lousy programmers.
Larry NivenLarry Niven quote #2