Skip to Content
Programming Perl, 3rd Edition
book

Programming Perl, 3rd Edition

by Larry Wall, Tom Christiansen, Jon Orwant
July 2000
Intermediate to advanced
1104 pages
35h 1m
English
O'Reilly Media, Inc.
Content preview from Programming Perl, 3rd Edition

Chapter 33. Diagnostic Messages

These messages are classified as follows (listed in increasing order of desperation):

ClassMeaning
(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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Perl, 4th Edition

Programming Perl, 4th Edition

Tom Christiansen, brian d foy, Larry Wall, Jon Orwant
Learning Perl, 7th Edition

Learning Perl, 7th Edition

Randal L. Schwartz, brian d foy, Tom Phoenix
Programming the Perl DBI

Programming the Perl DBI

Tim Bunce, Alligator Descartes

Publisher Resources

ISBN: 0596000278Supplemental ContentErrata