The presence of the word "FATAL" in the category list will escalate warnings in those categories into fatal errors in that lexical scope.
NOTE: FATAL warnings should be used with care, particularly FATAL => 'all'
.
Libraries using "warnings::warn" for custom warning categories generally don't expect "warnings::warn" to be fatal and can wind up in an unexpected state as a result. For XS modules issuing categorized warnings, such unanticipated exceptions could also expose memory leak bugs.
Moreover, the Perl interpreter itself has had serious bugs involving fatalized warnings. For a summary of resolved and unresolved problems as of January 2015, please see this perl5-porters post.
While some developers find fatalizing some warnings to be a useful defensive programming technique, using FATAL => 'all'
to fatalize all possible warning categories – including custom ones – is particularly risky. Therefore, the use of FATAL => 'all'
is discouraged.
The strictures module on CPAN offers one example of a warnings subset that the module's authors believe is relatively safe to fatalize.
NOTE: users of FATAL warnings, especially those using FATAL => 'all'
, should be fully aware that they are risking future portability of their programs by doing so. Perl makes absolutely no commitments to not introduce new warnings or warnings categories in the future; indeed, we explicitly reserve the right to do so. Code that may not warn now may warn in a future release of Perl if the Perl5 development team deems it in the best interests of the community to do so. Should code using FATAL warnings break due to the introduction of a new warning we will NOT consider it an incompatible change. Users of FATAL warnings should take special caution during upgrades to check to see if their code triggers any new warnings and should pay particular attention to the fine print of the documentation of the features they use to ensure they do not exploit features that are documented as risky, deprecated, or unspecified, or where the documentation says "so don't do that", or anything with the same sense and spirit. Use of such features in combination with FATAL warnings is ENTIRELY AT THE USER'S RISK.
The following documentation describes how to use FATAL warnings but the perl5 porters strongly recommend that you understand the risks before doing so.
[... actual documentation follows ...]