|Problems? Is your data what you think it is?|
Ways to store messages...by kiat (Vicar)
|on Dec 12, 2003 at 09:25 UTC||Need Help??|
kiat has asked for the
wisdom of the Perl Monks concerning the following question:
In a web environment, how do you normally deal with messages whether it's to do with a failed or successful operation? Examples of such messages are:
a) Wrong input.
I found this solution used by YaBB. The solution is to store an array of messages as follows:
An advantage of storing messages in the above manner is that the same message can be shared by different parts of the code. Another is that when the message content is changed, the change is effected in all the places it's used.
One disadvantage is that you don't know what a message is unless you look it up in the array. For example, if $msg5 is used somewhere in the code, after a while you tend to forget what it is and have to look at the array code to figure it out. This problem becomes obvious when you have lots of such messages or when the array is stored in another file.
How would you normally do it?
Looking forward to hearing your replies :)