Hi Bhusan,
Nice to see you are making progress.
As others have said, keep your config information out of the program code.
I often use what marinersk suggested, which is ENV variables. Each user can set the database config info as ENV variables and the program checks for these and either proceeds or throws an error. I usually set them in each user's .bashrc
Using an .ini file is also fine, although you might name it something like .ourapprc to follow convention if you are on a *nix/OSX system. Again each user keeps a copy of the file in his home directory, and the program reads in the data at startup.
You can combine one of these per-user solutions with a default conf file that holds data that will not change per user, e.g. the DB name and so on.
Main thing is to keep it all very simple!. Use a CPAN module to read your conf information, and maybe to write it.
Yes, JSON is the new standard format for static data, but if all you need is to store the user's DB username, password and maybe a couple of other things, use something simpler. I like Config::Tiny as it is VERY simple, pure Perl and the file format is familiar to almost everyone.
In reply to Re: Please suggest the best way .ini or pm
by 1nickt
in thread Please suggest the best way .ini or pm
by bhushanQA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |