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...
- 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.
- Always include in the same install location as the module and hope the user doesn't mind having it there and can find it.
- Somehow prompt the user to choose the location of their config file as part of the make install process. Which leads to the subquestions:
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.
- Can this be done? and
- How? and
- Is it considered good form anyway?
- 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.
- 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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
Outside of code tags, you may need to use entities for some characters:
- 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
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||