NAME

IX::Debug - environment-sensitive debugging tools for the IX web framework


SYNOPSIS

  use IX::Debug;
  
  ...
  
  print "Content-type: text/html\n\n";
  
  ...
  
  if ($IX::Debug::debug) {
          $IX::Debug::onscreen .= "your own debug output"; 
  }
  
  ...
  
  if ($IX::Debug::debug) {
          print "$IX::Debug::server_environment\n";
          print "$IX::Debug::server_hostname\n";
          print "$IX::Debug::onscreen\n";
  }
  else {
      print "Debugging currently off.\n";
  }


REQUIREMENTS

IX::Debug uses CGI and Sys::Hostname, which are both probably already in your Perl distribution.

If you are using IX::Session, the main program does not need to use IX::Debug.


DESCRIPTION

IX::Debug simply sets variables (as seen in the SYNOPSIS) that you can access in your main program.

Based on a list of current known application hosts, IX::Debug tries to determine if the environment is designated as ``development'' or ``production''. This value is set in the variable $IX::Debug::server_environment which is available to your main program. A ``test'' environment would also be considered ``development'' as known to IX::Debug.

The hostname of the server is also available in $IX::Debug::server_hostname.

By default, when $IX::Debug::server_environment is ``development'', $IX::Debug::debug is set to 1, and debugging is turned on. With debugging on, IX::Debug populates $IX::Debug::onscreen with the name/value pairs gathered by CGI.pm from your last application call. Append extra debug statements you may need to this variable, as shown in the SYNOPSIS.

When used in conjunction with IX::Session, any parameter name/value is filtered out of debug if it begins with ``IX_Session_password'' so that passwords are never shown onscreen.


METHODS

runDebug()

Used by IX::Template::process() to print debug data to the browser. Generally not called by a custom application.


AUTHORS

Written and maintained by Marcus Del Greco (marcus@mindmined.com)


TODO

Abstract @development_servers into a config variable.