Beefy Boxes and Bandwidth Generously Provided by pair Networks
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 ( #107936=note: print w/replies, xml ) Need Help??

in reply to Where should a module's static datafile reside?

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.

  • Comment on Re: Where should a module's static datafile reside?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://107936]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2022-01-20 16:22 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (57 votes). Check out past polls.