Tags:
create new tag
, view all tags

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

TWiki version: TWikiRelease01Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  

-- 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

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch Func.pm.patch r1 manage 0.5 K 2004-10-14 - 12:13 JChristophFuchs Patch for Func.pm
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2005-02-13 - SamHasler
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.