in reply to Saving changes to AppConfig configuration file
In stead of this approach, I now give the variables a default value during defining them:open (CONF, ">$conffile"); print CONF<<EOF option1 = default text option2 = other text EOF ; close CONF;
Then, of course, I change the creation of the file to:$config->define('option1', { DEFAULT => "default text" } ); $config->define('option1', { DEFAULT => "other text" } );
This way, I can change the variables through my Tk GUI and recreate the file (by calling the subroutine responsible):open (CONF, ">$conffile"); print CONF "option1 = ", $config->option1(), "\n"; print CONF "option2 = ", $config->option2(), "\n"; close CONF;
It might not be the best solution, but it works rather simple and well. But since we're talking Perl here, there must be other solutions and I'd love to hear them :)$config->option1('Specified through GUI'); &CreateConfigFile;
|
|---|