You don't actually need to assign to @AnyDBM::ISA in the percompilation stage, it will manage just fine later.- which is what you want- since you want the user input (from the CGI or some other method described below) The way I see it, you have a few options:
  1. Store the settings in a config file unique to your program- in this case I would recommend a file called /etc/MyProg.conf where you save the settings for later use. In the case of CGI, you'll want to start up by reading this file and keeping it in a configuration hash for checks whenever necessary. This way, the user has direct access to the configuration without going through some program goo. Since you are reading a pretty much static file every time you load your CGI, you should consider fastCGI or a mod_perl configuration.

    In /etc/MyProg.conf:

    
    UseDBType SDBM_File
    
  2. Always default to SDBM_File (or some other DB_File included in the default base Perl install)- choose one that's optimized for your purposes; most books have a nifty table displaying good/bad
  3. Have the program chose based on Perl's config hash. does it have the optimum performance for your use and does it exist? No, move on to second choice, etc.
The thing I would stay away from is exactly what you do: specifying a user-definable variable in a perl script (not mentioning that a bunch of variables wouldn't be most practical in a .pm module but rather in a simple .pl and then a quick require ...). You probably want it more user-friendly than that. Of course, the optimal solution would be to offer an option right in your CGI script which would collect all of the available DB_File stuffs, throw them into a menu and let the user decide- but this is usually not the most practical unless you are writing a full-blown Web App. if you're unsure, stick with the file since perl code may be cryptic and scary to some users, even if you put a "Change this line here and nothing else" line into the code. have fun!
AgentM Systems or Nasca Enterprises is not responsible for the comments made by AgentM- anywhere.

In reply to Re: AnyDBM_File and configing in a different module. by AgentM
in thread AnyDBM_File and configing in a different module. by skazat

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.