NAME
Perl::Critic::Policy::TestingAndDebugging::RequireUseWarnings
DESCRIPTION
Using warnings is probably the single most effective way to improve the quality of your code. This policy requires that the 'use warnings'
statement must come before any other statements except package
, require
, and other use
statements. Thus, all the code in the entire package will be affected.
NOTES
Up through version 0.15, this Policy only reported a violation for the first offending statement. Starting in version 0.15_03, this Policy was modified to report a violation for every offending statement. This change closes a loophole with the "## no critic"
pseudo-pragmas. But for old legacy code that doesn't use warnings, it produces a lot of violations. The best way to alleviate the problem is to organize your code like this.
## no critic 'RequireUseWarnings';
## Legacy code goes here...
## use critic;
use warnings;
## New code goes here...
In this manner, you can develop new code with warnings enabled, but still allow the warnings to be disabled for all your legacy code. Perl::Critic will only report violations of this policy that occur on lines after the "## use critic"
pseudo-pragma.
SEE ALSO
Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict
AUTHOR
Jeffrey Ryan Thalhammer <thaljef@cpan.org>
COPYRIGHT
Copyright (c) 2005-2006 Jeffrey Ryan Thalhammer. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module