[Mimedefang] Does MIMEdefang 'remember' variable values between successive invocations?
Rolf E. Sonneveld
R.E.Sonneveld at sonnection.nl
Wed Sep 7 05:08:10 EDT 2011
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
More information about the MIMEDefang
mailing list