in reply to Re^2: Passing DATA filehandle to a module under strict
in thread Passing DATA filehandle to a module under strict
I'd rather say, that if a tool, that is beneficial to the whole code, gets in the way of a small task, one should try to find out, whether there might be another way of doing this small task, without disabling the tool, and the benefits associated with its use.No, that doesn't make sense.
You're going to spend more time (finding out whether there's a way of doing it while keeping your precious "strict" (or "warnings" or something else), for the sake of keeping your tool enabled, and likely to end up with pointless code -- after which chromatic starts nagging you about "synthetic code".
If you're ever adding code just to silence a warning, you're doing it wrong. If you make code more complicated, just so you don't have to temporarely use "no strict", you're doing it wrong. If you're even going to spend time finding out whether you can do any of the above, you're not only doing it wrong, you're also wasting the money of whoever is paying you.
Feel free to draw some curly braces on your screen if one thinks this "better code" isn't part of some lexical block and is dumb enough to assume I advocate turning warnings off in the entire program.# Bad code: $foo = ($bar // 0) + 4 if ($var1 // 0) == ($var2 // 0); # Better code: no warnings 'uninitialized'; $foo = $bar + 4 if $var1 == $var2;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Passing DATA filehandle to a module under strict
by Anonymous Monk on Jan 26, 2012 at 15:14 UTC | |
by JavaFan (Canon) on Jan 26, 2012 at 15:19 UTC | |
by Anonymous Monk on Jan 26, 2012 at 15:29 UTC |