Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I have a few modules on CPAN (some older than others), and a few years back I switched from having all of the default information within the modules to instead placing it into separate config files. So the user doesn't need to go hack up the module to get their defaults into place. I consider this a good thing.

But I've never gotten it quite where I think it should be because the user still needs to at least specify the location of the config file. So every time they install a new version, they clobber that pointer to their personal config file and need to re-edit. Admittedly, the user will need to change 1 line instead of 50 (or whatever), but it's still something that needs to be done and adds opportunity to screw something up and waste people's time.

So what's a good way to deal with this? Some ideas I've had about this are...

  1. Always toss the config file into some global location (/etc/conf or whatever) and hope the user doesn't mind me stomping on their file system. Also hope the user has such a global location.
  2. Always include in the same install location as the module and hope the user doesn't mind having it there and can find it.
  3. Somehow prompt the user to choose the location of their config file as part of the make install process. Which leads to the subquestions:
    1. Can this be done? and
    2. How? and
    3. Is it considered good form anyway?
    I've never done more advanced make files like this, so a good make resource would be nice, too. A more dynamic build approach like this also has the advantage of ensuring that an update never stomps on an existing config file.
  4. Remove any default config information from the module and require the user to specify their own config file in their script. Yuck. While I like the idea of a runtime override, I don't want to require it.
  5. Leave it as is. If the code was hard to write, it should be hard to upgrade. This keeps me out of the business of finding their conf file and ensures I never overwrite it, but they need to remember to update their pointer.

So what'd be considered good form for this thing? Any suggestions of existing CPAN modules that handle this in a particularly slick fashion?

In reply to Config files in CPAN modules? by jimt

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (7)
    As of 2018-05-20 12:19 GMT
    Find Nodes?
      Voting Booth?