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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.