3

I just went through a large legacy Perl web application (built using cgi-lib.pl and running as CGI with Apache HTTPD) and updated every script to use strict;, fixing a lot of small bugs along the way. Now this is done, I want to prevent people from turning off strict mode. Is there any way for me to enforce that? (We have had this issue before, where use strict; was commented out with a note that it "doesn't work".)

1

2 Answers 2

4

There is no substitute for a good code review process and people who care about it. Make strict the default by including it in templates, should be as automatic as a copyright header. File issues. Fine if issues are low priority, but should be taken care of at some point when relevant code is touched. If closed, require better documentation than "doesn't work".

After people agree to this standard, enforce it. Put it somewhere obvious in your tooling, like a lint or tidy config, CI build check, or version control system pre commit check.

1

The perlcritic tool has a policy for that: RequireUseStrict. So you can configure perlcritic to scan all scripts files and report an error if that policy is not respected.

So you have to find a way for the perlcritic utility to be launched regularly and to reports its results. Continuous Integration (CI) services just exist for that purpose.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .