I need a way to control the behaviour of an addon using addon-specific variables, similar to a plugin.
So when my addon is unzipped, I want SOMEADDON_VARIABLE to be defined by virtue of the unzipping process. I then want to be able to override that value in
WebPreferences and the user's personal topic, like a variable declared in
TWikiPreferences.
I can obviously do it by asking the installer to manually edit
TWikiPreferences as a post-install step, but I don't think that's very friendly. I could also do it by creating a Plugin with the same name, but that's nasty.
Anyone got any ideas?
If there's no way to do it today, how about some way to load a preferences object with a resolution chain? For example:
my $prefs = TWiki::Func::loadPreferences( "TWiki.SomeAddOn,TWiki.TWikiPreferences,%WEB%.WebPreferences,%MAINWEB%.$userName" );
my $var = $prefs->getPreferencesValue( "SOMEADDON_VARIABLE" );
This would of course necessitate publishing the Prefs class through Func; some would argue this is the way Func should be done anyway.
--
CrawfordCurrie - 26 Feb 2003