BoredByPolitics has asked for the wisdom of the Perl Monks concerning the following question:
I've spent the evening looking at the AppConfig module, trying to work out the best way to use it in my application.
The basic functionality I'm trying to create is fairly standard -
- Read a pre-named configuration file unless an alternative is specified on the commandline
- Superceed the read parameters with those specified (if any) on the commandline.
Now, because the methods that parse a configuration file, and the commandline, are one shot tasks, at first glance it would appear that I'm going to have to parse the commandline, save the parameters specified in a hash, read in the correct configuration file, then overlay the stored parameters with those just loaded.
This may be the right way to go about it, but something's nagging at me that I'm missing something. Which leads me onto the second half of my question...
I notice that I can find out the configuration values held in the AppConfig object with the following method (right terminology?) - $config_object->variable_name();
Should I therefore avoid storing the result of this method in another variable, calling this method each time I need the value, or is this the overhead equivalent of calling a function multiple times needlessly?
I've not yet sat down and investigated OO for myself yet, having merely picked up bits here and there (mostly from using other peoples perl modules), so be gentle if I'm way off track!
Pete
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: AppConfig variables and OO
by ichimunki (Priest) on Jan 10, 2001 at 20:48 UTC | |
by BoredByPolitics (Scribe) on Jan 10, 2001 at 22:57 UTC | |
Re: AppConfig variables and OO
by Caillte (Friar) on Jan 10, 2001 at 20:34 UTC |