Bug: getPluginPreferencesFlag Does Not Work
I am setting the DEBUG flag to 1 for a few Plugins. And I think there must be at least the output of the plugin init in data/debug.txt.
But there is nothing written to data/debug.txt.
Is there any TWiki master flag to enable /disable the debug function TWiki::Func::writeDebug ?
Please help me.
Addition:
Has nothing to do with TWiki::Func::writeDebug. I set the $debug flag in Plugin to 1 ($debug=1;) and now it is debugging.
So it might be a problem with $debug = TWiki::Func::getPluginPreferencesFlag( "DEBUG" );
Why the $debug variable is not set correctly?
Environment
--
MarkusKolb - 18 Sep 2004
Answer
There's no master flag. Check your setting of $debugFilename in TWiki.cfg, and check your apache error log. However the implementation of getPluginPreferencesValue is badly broken. See
GetPluginPreferencesValueBroken - this may be your problem.
--
CrawfordCurrie - 19 Sep 2004
No solution. I use getPluginPreferencesFlag() in the init of the plugin. So it is in main package.
But nothing is written to $debugFilename until I add a $debug = 1; behind the $debug = ...::getPluginPreferencesFlag( "DEBUG" ).
I have used the
EmptyPlugin, copied and renamed it and added my code to it.
So this part with $debug = is the same as in
EmptyPlugin and the same as in
DefaultPlugin.
So I am really wondering why $debug becomes not 1.
--
MarkusKolb - 20 Sep 2004
I've switched from getPluginPreferencesFlag() to getPluginPreferencesValue() and now it works.
But the one with Flag() works in
DefaultPlugin why not in my own plugin?
--
MarkusKolb - 20 Sep 2004
I think I just twigged.
getPluginPreferencesValue uses
caller to find out the name of the package it is used from, and hence the name of the plugin, so it should work. But
getPluginPreferencesFlag is (I think) defined to call
getPluginPreferencesValue - therefore the package for
caller will be TWiki::Func.
Try using
getPluginPreferencesValue instead of
getPluginPreferencesFlag. If this really is the problem, please add it to
GetPluginPreferencesValueBroken
--
CrawfordCurrie - 20 Sep 2004
It is indeed the fact, that
caller returns the wrong package. Attached is a patch for Func.pm which fixes the bug.
--
JChristophFuchs - 14 Oct 2004
Thanks Christopher! The fix is now in
SVN.
--
PeterThoeny - 21 Oct 2004