|
HTML::Debug - Enables the output of variable and query debugging information for display in HTML. |
HTML::Debug - Enables the output of variable and query debugging information for display in HTML.
use HTML::Debug;
my $obj = HTML::Debug->new();
# do some stuff with $obj here...
HTML::Debug allows the developer to add variables and queries to HTML debugging output. The variables and their values will be color-coded based on type. The queries are displayed with their name, SQL statement, database driver, database name, number of records affected, bind values, and the script name the query is from. The variables are displayed in alphabetical order and the queries are displayed in the order they were added to the debugging.
This module makes use of Data::Dumper to do the hard work of displaying the actual variable values. Some string manipulation is done on the output of Data::Dumper, but just for aesthetic reasons.
The + and += operators have been overloaded to emulate the add() method.
The ``'' operator has also been overloaded so you can:
print $obj;
and not have to worry about the make() method.
The following section documents the methods for HTML::Debug.
Example:
my $obj = HTML::Debug->new(); or
my $obj = HTML::Debug->new(1);
Example:
$obj->add('myvar', $myvar);
The queries are displayed last and are in the order that they were added to the HTML::Debug object. Information displayed with each query include: the query's name, the script on which it ran, the number of rows affected, the database driver name, the database name, the SQL statement, and the bind values, if any.
The variable names, variable values, SQL statements, and bind values are HTML-escaped before output.
Example:
print $obj->make();
Examples:
$obj += ['myvar', $value];
$obj = $obj + ['myvar', $value];
$obj + ['myvar', $value];
$obj += 3; #anonymous variable
$obj->i($i);
If inside a loop, you will see a value of $i for each cycle through the loop.
Here is how you would configure HTML::Debug to work with HTML::Mason:
In httpd.conf: PerlSetVar MasonAllowGlobals $d
In autohandler: <%once> use HTML::Debug; </%once>
<%init> local $d = HTML::Debug->new(); </%init>
<%cleanup>
$m->print( $d->make() );
</%cleanup>
Hopefully none.
Mike Randall <randall@ku.edu>
Mike Randall <randall@ku.edu>
|
HTML::Debug - Enables the output of variable and query debugging information for display in HTML. |