Hi, Jan-Pieter,
On 9/7/11 10:14 AM, Jan-Pieter Cornet wrote:
On 2011 Sep 7, at 0:08 , Rolf E. Sonneveld wrote:
If this is as designed, then what is the best way to reset/undefine
these variables? Is it just: redefine with empty string?
It's best not to use too many global variable. (I know that's a funny
statement coming from the author of MIMEDefang, but hey... everyone makes
youthful mistakes...)
If you must use global variables, I recommend defining a function
like this:
If you're using a configuration file, it's probably even better to store the
configuration in a special hash, such as %Conf.
The advantage is that it's immediately obvious where configuration variables
come from, you no longer need 'no strict refs' in your code in reading the
config... just $Conf{$key} = $value in the loop.
And it's trivial to 'reset' the configuration by doing '%Conf = ()'
The only disadvantage that I can see is that with globals, you get a protection
against typo's if you declare all your globals, so
$SlightlyMispeledVariableName will trigger an error, where
$Conf{SlightleyMispeldVariabelName} won't trigger a warning, except possibly
for use of undefined value.
thanks for the suggestion, seems to provide a very elegant solution!
/rolf
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.
Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang