in reply to turn off strict for production code
The if pragma module would do the trick:
use if $ENV{'DEVELOPMENT'}, strict;
Your first snippet didn't work because use strict occurs at compile-time (even if the check is only done at run-time).
Your second snippet didn't work because use strict is file and block scoped.
Turning off strict in production is a bad idea. You can quickly check all your files for strict compliance by using perl -c script.pl and perl -c module.pm, so there's no reason for a customer to find a strict error. In fact, if the customer finds a strict error, it means that file was never tested at all!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: turn off strict for production code
by blahblahblah (Priest) on Sep 12, 2005 at 15:48 UTC | |
by ikegami (Patriarch) on Sep 12, 2005 at 15:56 UTC | |
by Anonymous Monk on Sep 12, 2005 at 16:04 UTC | |
by ikegami (Patriarch) on Sep 12, 2005 at 16:14 UTC | |
by Anonymous Monk on Sep 12, 2005 at 16:35 UTC | |
|