Hi,

I work on a very large cgi program that until this year did not use strict at all. I know that's terrible, and I'm not looking to justify it. In fact we're trying to reform our ways, and that's what this post is about.

In our most recent version we finally added 'use strict;' to some files. We found a lot of errors during development and a few more during testing, and felt pretty confident by the time we released the version. However, since the release our customers have uncovered a few more errors (always because of symbolic references). I suspect more are lurking, and because we don't have any automated testing it's not likely that we'll find every combination of settings/inputs that cause these errors. That means our customers will find the problems, which is bad.

I'd like to keep strict on for development and testing and then comment it out in the final code that we ship. Is there an easy way to do this without actually keeping different versions of the code?

This gives a syntax error:

use strict if $ENV{'DEVELOPMENT'}
This doesn't get an error but it only affects the "if" block:
if ($ENV{'use_strict'}) { use strict; }

I'd like to keep the whole script (including the #! line) the same so that we can't accidentally send someone a patch in which we forgot to comment out strict. Anyone have an idea of how to do this?

-Joe


In reply to turn off strict for production code by blahblahblah

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.