[Melbourne-pm] Using strict...
shlomif at iglu.org.il
Tue Feb 20 09:21:48 PST 2007
On Tuesday 20 February 2007, Craig Sanders wrote:
> On Tue, Feb 20, 2007 at 02:44:58PM +1100, Tim Hunt wrote:
> > My options seem to be to declare all the variables in the main script
> > and carry on regardless, or implement a better config method.
> > Discussion appreciated.
> two thoughts spring to mind:
> 1. unless they're huge, it's often better to just rewrite crufty old
> cgi scripts from scratch. at least that way you'll know that they've been
> written with best practice (incl. best security practice) in mind.
> actually, even if they're huge it's still a good idea. it just takes
> longer :)
Well, some people (including me) disagree with you on these claims:
3. http://video.google.com/videoplay?docid=2538831956647446078&q=moolenaar -
towards its end Bram Moolenaar (the lead Vim developer) mentions how the
elvis (an alternative vi clone) developer decided that elvis's codebase was
not good enough and that he should rewrite it. He spent 2 years doing so,
without a single release, and ended up with an editor that didn't have all of
the original codebase's features. As a result, hardly anyone today uses
elvis, while vim is very popular.
Crufty scripts that don't have strict can be made to have it. If they suffer
from other problems - these problems can be fixed incrementally while
maintaining the integrity of the original code. Rewriting the code is much
more time consuming, introduces more bugs, and requires much more mental
> 2. if the config files are just perl (or very perl-like) code, have you
> considered replacing the "while(<IN>)" loop with just "require A.cfg;" ?
> that would require editing the .cfg files to add "my" in front of variable
> assignments, so that it works with strict...but may be the simplest fix.
> alternatively, as you suggest, pre-declare them in the main scripts.
Shlomi Fish shlomif at iglu.org.il
Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
More information about the Melbourne-pm