throop has asked for the wisdom of the Perl Monks concerning the following question:
I am running analyses on several 'families' of text files (Hazard reports, requirements documents, FMEAs.)
A Perl program analyzes the text-files. The program has many options, which I store in a HoH called %runSwitches. Each text-file needs a slightly different set of options.
Each document family has a default set of options, which must be tweaked for the particular text file.
Here's how I set it up: Each document has a short configuration file – documentName.pl. Each family has a file with a set of defaults – family_defaults.pl. The short configuration file loads the defaults, then asserts the tweeks:
This works fine. Except now I have a script that iterates though all the documents in a family. The first doc called loads the defaults and runs fine. The second file executes require "family_default.pl"; and does nothing, because family_default.pl is already in %INC. So the tweaks from the first file are still in effect, and I lose. I couldrequire "family_default.pl"; # default values into %runSwitch +es %runSwitches = (%runSwitches, # tweeks for a single document switch1 => 'tweek1', switch2 => 'tweek2');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Right way to force the reloading of a file
by ikegami (Patriarch) on Sep 14, 2009 at 20:46 UTC | |
|
Re: Right way to force the reloading of a file
by moritz (Cardinal) on Sep 14, 2009 at 20:43 UTC | |
|
Re: Right way to force the reloading of a file
by gloryhack (Deacon) on Sep 16, 2009 at 04:06 UTC |