|Perl: the Markov chain saw|
Re: Where should a module's static datafile reside?by Anonymous Monk
|on Aug 26, 2001 at 19:22 UTC||Need Help??|
In your specific case, I would place the datafile with the application the data is provided by. I tend to like things grouped together that were delivered together. I would then have a config file for the script that points to the database file. This makes it easier to figure out what came with what. For some reason, I can never rely on someone reading the docs I write. Fancy that ;-). If you are working on a system where someone else has the chance to arbitrarily move the application, then I would suggest a global .ini file or shell vars to specify the applications location. This allows all applications to utilize the same info without having to know where to look for anything but the .ini/shell vars (and it is now not your resposibility). Now, the sysadmin can move the app around to their hearts content (been there!) and your app always knows right where to look - and if it does not, it is not your software that is broken, but their configuration. CYA big time. I hate those 2:00 am phone calls because someone did not do what they were supposed to do. Now, they get the phone calls, because the app says "configuration elements missing, call systems administrator." Wahoo!
I have a few rules of thumb as to where the datafile belongs.
I - If the datafile is used only by the module, and never by the USEing program(s), then I tend to put it in a data directory in the Module directory (never in the same directory - I think I am superstitious ;-) I find I almost never have a datafile that fits this!
II - If the datafile is used by the program, then I place the datafile in a subdirectory called data in the program directory.
III - If the datafile is to be used by multiple programs (not simultaneously) in the same application, then I place it in a data directory in the main application directory.
IV - If the datafile is to be used by multiple applications, then I use either a system directory (/usr/local/data, /home/data,/usr/data ...) or a web directory (depending on how the applications are used).
Typically I find that almost all datafiles I use do not belong with the Module, as the dat they contain is related to the application itself.