user-pic

xenu

  • About: Die-hard Windows user and Perl programmer.
  • Commented on use strict;
    I saw this comment in CGI::Simple code: # this module is both strict (and warnings) compliant, but they are only used # in testing as they add an unnecessary compile time overhead in production....
Subscribe to feed Recent Actions from xenu

  • Robert commented on use strict;

    I am guessing you should leave warnings on because they are just that "warnings" and maybe signs that you need to test areas of your code that your test suite didn't.

  • Aristotle commented on use strict;

    Actually there is a case to be made for turning warnings off in production. (You don’t want log files to overflow with useless messages just because you upgraded eg. some modules or perl and your tests didn’t catch the issue.)

    But at least the refs stricture should stay on at all times. Turning it off in production means that your code is suddenly no longer safe from symbolic references if there is a bug that misinterprets user data.

    In any case the overhead of strict is negligible.

  • Adam Kennedy commented on use strict;

    I concur with Aristotle that there's an excellent case for leaving warnings off in production.

    I actually leave warnings off in development as well, and turn it on in test scripts with

    #!/usr/bin/perl

    BEGIN {
    $^W = 1;
    }

  • Michael J commented on use strict;

    There's also a good case for leaving warnings on in production, and ensuring that log files/cron STDERR emails are kept tidy by either fixing code or explicitly ignoring unavoidable warnings from sections of code or noisy modules (PDF::API2 being our main offender). A number of bugs have been caught by warnings (e.g. uninitialised values) when in production.

  • Aristotle commented on use strict;

    For my part, I did explicit say “a case” – and then not even “a good case”. :-) Because there are two sides to that coin, and yes, your argument presents part of the other.

    What I was aiming for though is the contrast that no such case can be made for turning off strictures in production, and a strong case can in fact be made against turning off the refs stricture in particular.

Subscribe to feed Responses to Comments from xenu

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.