The following module was proposed for inclusion in the Module List:
modid: Debug::ShowStuff
DSLIP: Rdpfp
description: Handy routines for displaying values
userid: MIKO (Miko O'Sullivan)
chapterid: 3 (Development_Support)
communities:
similar:
rationale:
NAME
Debug::ShowStuff - A collection of handy debugging routines for
displaying the values of variables with a minimum of coding.
SYNOPSIS
use Debug::ShowStuff ':all'; # display values of a hash or hash
reference showhash %hash; showhash $hashref; # display values of an
array or array reference showarr @arr; showarr $arrref; # show all
nested structures showref $reference # show all the params received
through CGI showcgi(); # A particularly fancy utility: display
STDERR # at top of web page my $warnings = showstderr;
DESCRIPTION
"Debug::ShowStuff" grew dynamically from my needs in debugging
code. I found myself doing the same tasks over and over...
displaying the keys and values in a hash, displaying the elements in
an array, displaying the output of STDERR in a web page, etc.
"Debug::ShowStuff" began as two or three of my favorite routines and
grew as I added to that collection. Finally I decided to publish
these tools in the hope that others will find them useful.
"Debug::ShowStuff" is intended for debugging, not for production
work. I would discourage anyone from using "Debug::ShowStuff" in
ready-for-primetime code. "Debug::ShowStuff" is only for
quick-n-dirty displays of variable values in order to debug your
code.
These functions display values that I personally like them
displayed, but your preferences may be different. I encourage you to
modify "Debug::ShowStuff" to suit your own needs.
TEXT MODE and WEB MODE
The functions in "Debug::ShowStuff" are designed to output either
in plain text mode (like if you're running the script from a command
prompt, or in web mode (like for a CGI). If the script appears to be
running in a CGI or other web mode (see the "inweb" function) then
values are output using HTML, with special HTML characters escaped
for proper display. Othewise the values are output as they are.
Generally you won't need to bother telling the routines
"Debug::ShowStuff" which way to display stuff... it figures it out
on its own.
DYNAMIC OUTPUT and RETURN
The functions that start with "show" dynamically either output to
STDOUT or STDERR, or return a string to a variable, depending on the
context in which the functions are called. For example, if you call
showhash in a void context:
showhash %myhash;
then the contents of %myhash are output to STDOUT. On the other
hand, if the function is called in scalar context:
my $var = showhash(%myhash);
then the same string that would have been output to STDOUT is
instead returned and stored in $var. If the function is called in
list context:
my @arr = showhash(%myhash);
then the array is assigned a single element that consists of the
entire string that should be output.
enteredby: MIKO (Miko O'Sullivan)
enteredon: Wed May 28 18:40:18 2003 GMT
The resulting entry would be:
Debug::
::ShowStuff Rdpfp Handy routines for displaying values MIKO
Thanks for registering,
--
The PAUSE
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=08400000_15f4268d5f21ebde&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=08400000_15f4268d5f21ebde&SUBMIT_pause99_add_mod_insertit=1