C4::Debug - Standardized, centralized, exported debug switches.
use C4::Debug;
The purpose of this module is to centralize some of the "switches" that turn debugging off and on in Koha. Most often, this functionality will be provided via C4::Context. C4::Debug is separate to preserve the relatively stable state of Context, and because other code will use C4::Debug without invoking Context.
Although centralization is our intention, for logical and security reasons, several approaches to debugging need to be kept separate. Information useful to developers in one area will not necessarily be useful or even available to developers in another area.
For example, the designer of template-influenced javascript my want to be able to trigger javascript's alert function to display certain variable values, to verify the template selection is being performed correctly. For this purpose the presence of a javascript "debug" variable might be a good switch.
Meanwhile, where security coders (say, for LDAP Auth) will appreciate low level feedback about Authentication transactions, an environmental system variable might be a good switch. However, clearly we would not want to expose that same information (e.g., entire LDAP records) to the web interface based on a javascript variable (even if it were possible)!
All that is a long way of saying THERE ARE SECURITY IMPLICATIONS to turning on debugging in various parts of the system, so don't treat them all the same or confuse them.
export KOHA_DEBUG=1; perl t/Auth.t;
use C4::Debug; use C4::Dates; BEGIN { $C4::Debug::debug = 1; } # now any other dependencies that also use C4::Debug will have debugging ON.
http://www.mylibrary.org/cgi-bin/koha/opac-search.pl?q=history&debug=1
<input type="hidden" name="debug" value="1" />
The former methods mean $cgi_debug is exposed. Do NOT use it to trigger any actions that you would not allow a (potentially anonymous) end user to perform. Dumping sensitive data, directory listings, or emailing yourself a test message would all be bad actions to tie to $cgi_debug.
Debugging at the database level might be useful. Koha does not currently integrate any such capability.
Debug values range from 0 to 9. At zero (the default), debugging is off.
Joe Atzberger atz AT liblime DOT com
CGI(3)
C4::Context