Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Development version of a script?by ELISHEVA (Prior) |
on Feb 07, 2011 at 23:02 UTC ( [id://886838]=note: print w/replies, xml ) | Need Help?? |
Perl gives you at least three different ways to dynamically choose what file Perl loads:
The difference between them is that
For more information see require, do, and eval. One additional thought: If you have 40 variables that all co-vary together depending on context (development vs. production), perhaps you might consider bundling those variables in a configuration object/class. That would make any future work with these variables (in particular additional setting sets for testing purposes) much much easier to manage. 40 of anything is not a small number and is hard for the human eye to check and recheck. It is important that you use code structure/data organization as much as possible to ensure that they are set up as a group. If you decide eventually to go the object route, you might also want to consider using YAML to store the settings. The data files are very easy to write by hand (and read) and they can be loaded and dumped with ease. Update: revised pros/cons of eval - not using @INC can sometimes be desired. Update: added YAML suggestion update: changed quotes to backticks on eval
In Section
Seekers of Perl Wisdom
|
|