|Welcome to the Monastery|
Is it time for 'use stricter'?by xdg (Monsignor)
|on Aug 24, 2005 at 14:49 UTC||Need Help??|
Perhaps it's due to the recent release of TheDamian's book, Perl Best Practices, or maybe there's just something in the air, but perlstyle interest seems to be flourishing. Recent examples include Things I Don't Use in Perl, Perl Best Practices for naming variables and Perl Best Practices (review).
Maybe its time for style to be more than just a recommendation. Inspired by the recent, lengthy debate on the module-authors list about RFC: Test::Stupid, I'm wondering if it's time for a new pragma: 'stricter'.
stricter would use source filtering to check not just for the usual 'vars', 'refs' and 'subs', but for style no-no's as well. Examples of individual options might include:
As with strict, failure of any code following 'use stricter' to meet the style requirements would cause compilation to fail with an appropriate error message and a pointer to the offending line. Of course, any of these could be turned off within a particular block with an appropriate 'no stricter' line.
It is important that stricter should be easy to subclass to customize style restrictions for particular flavors or projects, e.g. 'use stricter::pbp'. This feature would allow teams of Perl programmers to easily standardize and check their coding practices by simply customizing and adding an appropriate stricter to their modules and scripts.
I think this would be a valuable addition to the Perl pragma family. Don't you?
(If you've read this far and haven't figure out that I mean this in jest, please take a deep breath and walk around in the fresh air a bit -- you're entirely too wound up. Sometimes we need to not take ourselves too seriously.)Regards,
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.