[Mimedefang] Does MIMEdefang 'remember' variable values between successive invocations?
Jan-Pieter Cornet
johnpc at xs4all.net
Wed Sep 7 04:14:04 EDT 2011
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.
--
Jan-Pieter Cornet <johnpc at xs4all.net>
Systeembeheer XS4ALL Internet bv
Internet: www.xs4all.nl
Contact: www.xs4all.nl/contact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 227 bytes
Desc: This is a digitally signed message part
URL: <https://lists.mimedefang.org/pipermail/mimedefang_lists.mimedefang.org/attachments/20110907/f93a0320/attachment.sig>
More information about the MIMEDefang
mailing list