zachhh has asked for the wisdom of the Perl Monks concerning the following question:
I don't know if this is wise, but I'd like to be able to set global default variables for a package at build time. The perl module is a back end designed to communicate with a JavaScript front end (see https://github.com/zachhh/Packform). The global variables are for things like the path (as in the href attribute of a script tag, not strictly the path on disk) for including the front end JS, the desired version of jQuery and the jQuery UI, etc.
This is entirely out of laziness -- I don't want to have to provide this information in every script using the module. The defaults are hardcoded to be suitable for the server on which it was built. I want to be able to specify these when I install it.
This would necessarily have to change the variable initializations in the .pm file (which seems dangerous -- but hey, make test will tell them something's wrong if they mess it up). Of course, this could also come from a configuration file or the like. But, that seems dirty too.
Is this approach unwise?
If this is a reasonable approach, what are the recommendations? Should this be done in Makefile.PL somehow? Should there be a conf file that is provided and ask the user to modify that if they want changes? How should that be incorporated?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Configure global default variables in package at install time
by vsespb (Chaplain) on May 21, 2013 at 13:48 UTC | |
|
Re: Configure global default variables in package at install time
by pokki (Monk) on May 21, 2013 at 14:37 UTC | |
|
Re: Configure global default variables in package at install time (File::UserConfig )
by Anonymous Monk on May 21, 2013 at 21:41 UTC |