November 2001
Beginner
320 pages
5h 53m
English
Error trapping and handling is a necessary part of all programming. There are many different specific reasons for trapping an error, but they basically come down to two basic reasons:
Avoiding doing something that would cause the program/application to fail at a later stage. For example, checking that we've opened a file correctly before we start writing to it.
Letting the user know when something has happened that either you didn't plan on or expect. For example, suddenly running out of disk space.
The model used by Perl is borrowed heavily from the C and shell script methods of checking the results of function calls. This presents some problems when dealing with certain errors, and also makes propagating ...