Going over someone's code and within five lines I'd seen no -w, no check of the return value of open, and a halfassed homebrew reimplementation of the standard FileCache module. The alarm bells were ringing so loud in my head that they temporarily drowned out the voices telling me to kill.
I don't generally put -w in start-up line. I figure that the average runner of the tool isn't going to care enough to look up the warnings they get, and when I'm testing/debugging I run the script using "perl -w" anyway. It makes it easier with shell-history-substitution to add/subtract other flags like -d.
On the other hand, anything that is important enough to go from one-liner to actual script runs under strict, even if it's only 10-15 lines long.
I've found that 'use of uninitialized value in concatenation (.)' usually indicates something wrong. Remember that it doesn't warn if you're just using.= on an uninitialized variable. It happens, for example, when I interpolate an uninitialized variable into a string. Do you normally want to do that?
Interesting difference in coding style. I like to make my programs -w clean by initializing variables and generally being a tidy Kiwi. That way if I get an "uninitialized value in concatenation", I know something's happened that I didn't expect. I use Perl's warnings to help me find bugs, rather than treating them as an irritation to be muzzled. I don't have a high opinion of my programming skills and will take help whereever I can get it!:-)
Same here, but in fact I've internalized the rules for when warnings occur enough that I don't initialize things that Perl doesn't warn about, like strings that I'm going to use.= on, or arrays that I'm going to push() things onto, or sometimes booleans that I may later set to true. And now when I use PHP I get irritated because PHP's warnings are different and I have to do more initialization -- also it isn't as good as Perl at warning about possible typos in variable names ("name only used once").
# this is the worst damned warning ever, so SHUT UP ALREADY! $SIG{__WARN__} = sub { warn @_ unless $_[0] =~/Use of uninitialized value/ };
I like -w. In Slash we just have so many lines of code that variables are not always initialized (and frankly, I find that initializing every variable causes a lot of clutter when you already have a ton of lines of code).
Having just downloaded WebMin to have a look-see at how it did what it did, when I was informed that it was made of Perl, I was quite astounded to see that it used the old cgi-lib.pl constructs and stuff that looks more like perl 4 than perl 5 (at least from what little I remember.. I wasn't really around then much but I do recall Perl looking a LOT more confusing back then than it does now)
A quick grep through the source found one instance of CGI.pm that wasn't really being used as CGI.pm should be, and n
...I've had to dig into the code a lot and I've found it's not so bad. The thing I really wish jcameron had done was to use some kind of template scheme. Currently html is hard coded in all over the place.
try this one... (Score:1)
I, Heretic (Score:2)
I don't generally put -w in start-up line. I figure that the average runner of the tool isn't going to care enough to look up the warnings they get, and when I'm testing/debugging I run the script using "perl -w" anyway. It makes it easier with shell-history-substitution to add/subtract other flags like -d.
On the other hand, anything that is important enough to go from one-liner to actual script runs under strict, even if it's only 10-15 lines long.
--rjray
Re:I, Heretic (Score:1)
I don't generally put -w in start-up line.
Me too. I include 'use strict' in the smallest of scripts, but -w is bloody useless. 'perl -wc ' is great though. Screw runtime warnings.
OH PLEASE WARN ME ABOUT 'use of uninitialized value in concatentation (.)' AGAIN!
Re:I, Heretic (Score:2)
.=on an uninitialized variable. It happens, for example, when I interpolate an uninitialized variable into a string. Do you normally want to do that?Re:I, Heretic (Score:1)
yup. Most of the time, I don't care.
Re:I, Heretic (Score:2)
--Nat
Re:I, Heretic (Score:2)
.=on, or arrays that I'm going topush()things onto, or sometimes booleans that I may later set to true. And now when I use PHP I get irritated because PHP's warnings are different and I have to do more initialization -- also it isn't as good as Perl at warning about possible typos in variable names ("name only used once").Re:I, Heretic (Score:2)
mMmM yes, Help you to read, it can. (Score:1)
A quick grep through the source found one instance of CGI.pm that wasn't really being used as CGI.pm should be, and n
As the Debian webmin maintainer (Score:1)
...I've had to dig into the code a lot and I've found it's not so bad. The thing I really wish jcameron had done was to use some kind of template scheme. Currently html is hard coded in all over the place.
--
જલધર