How could I find out what kind of warnings get enabled when I use the warning-pragma?
Is there a command or a variable that shows me all the different warnings w开发者_运维技巧hich get enabled when I use the warning-pragma?
perldoc warnings shows the hierarchy of categories warnings uses. (Though before perl 5.20, this was in perldoc perllexwarn.)
Run:
perldoc perldiag
The output starts:
NAME
perldiag − various Perl diagnostics
DESCRIPTION
These messages are classified as follows (listed in increasing order of desperation):
(W) A warning (optional).
(D) A deprecation (optional).
(S) A severe warning (enabled by default).
(F) A fatal error (trappable).
(P) An internal error 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 & S) can be controlled using the "warnings" pragma.
精彩评论