use CGI::Pretty qw( :html3 ); # Print a table with a single data element print table( TR( td( "foo" ) ) );
When using the CGI module, the following code:
print table( TR( td( ``foo'' ) ) );
produces the following output:
If a user were to create a table consisting of many rows and many columns, the resultant HTML code would be quite difficult to read since it has no carriage returns or indentation.
CGI::Pretty fixes this problem. What it does is add a carriage return and indentation to the HTML code so that one can easily read it.
print table( TR( td( "foo" ) ) );
now produces the following output:
push @CGI::Pretty::AS_IS,qw(CODE XMP);
$CGI::Pretty::INDENT = "\t\t";
would cause the indents to be two tabs.
Similarly, if you wish to have more space between lines, you may change the $LINEBREAK variable:
$CGI::Pretty::LINEBREAK = "\n\n";
would create two carriage returns between lines.
If you decide you want to use the regular CGI indenting, you can easily do the following:
$CGI::Pretty::INDENT = $CGI::Pretty::LINEBREAK = "";
Copyright 1999, Brian Paulsen. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Bug reports and comments to [email protected]. You can also write to [email protected], but this code looks pretty hairy to me and I'm not sure I understand it!