Chapter 33. Diagnostic Messages
These messages are classified as follows (listed in increasing order of desperation):
| Class | Meaning |
|---|---|
| (W) | A warning (optional) |
| (D) | A deprecation (optional) |
| (S) | A severe warning (mandatory) |
| (F) | A fatal error (trappable) |
| (P) | An internal error (panic) that you should never see (trappable) |
| (X) | A very fatal error (nontrappable) |
| (A) | An alien error message (not generated by Perl) |
The majority of messages from the first three
classifications above (W, D, and S) can be controlled using the
warnings pragma or the -w and
-W switches. If a message can be controlled by
the warnings pragma, its warning category is given
after the classification letter; for example, (W misc) indicates a
miscellaneous warning. The warnings pragma is
described in Chapter 31.
Warnings may be captured rather than printed by setting
$SIG{__WARN__} to a reference to a routine that will
be called on each warning. You can also capture control before a
trappable error "dies" by setting $SIG{__DIE__} to a
subroutine reference, but if you don't call die
within the handler, the exception is still thrown when you return from
it. In other words, you're not allowed to "de-fatalize" an exception
that way. You must use eval for that.
Default warnings are always enabled unless they are explicitly
disabled with the warnings pragma or the
-X switch.
In the following messages, %s stands
for an interpolated string that is determined only when the message is
generated. (Similarly, %d stands for an interpolated number--think ...