[Melbourne-pm] Using strict...

Craig Sanders cas at taz.net.au
Mon Feb 19 20:05:22 PST 2007


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 :)

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.

craig

-- 
craig sanders <cas at taz.net.au>

"It may be that ministers really think that their prayers do good and
 it may be that frogs imagine that their croaking brings spring."
           [Robert G. Ingersoll, "Which Way?", 1884]


More information about the Melbourne-pm mailing list