Fault::DebugPrinter - A Debug print controller with levels.
use Fault::DebugPrinter; $class_object = Fault::DebugPrinter->new ($level); $class_object = $class_object->new ($level); $class_object = Fault::DebugPrinter->new; $class_object = $class_object->new; $didprint = Fault::DebugPrinter->dbg1 ($msg); $didprint = $class_object->dbg1 ($msg); $didprint = Fault::DebugPrinter->dbg ($level,$msg); $didprint = $class_object->dbg ($level,$msg); $curlvl = Fault::DebugPrinter->level ($level); $curlvl = $class_object->level ($level); $curlvl = Fault::DebugPrinter->level; $curlvl = $class_object->level;
UNIVERSAL
This Class does not have instance objects, only a single 'Class Object'. It is always referenced under the Class name. It supplies a simple mechanism for run time selection of how much Diagnostic message detail will be displayed. By setting the level to zero, all Diagnostic printouts are disabled. It can be used either in a mode that emulates a simple enable/disable of diagnostics or with multiple levels with more and more detail printed at each higher level. It is entirely at the user's discretion.
use Fault::DebugPrinter; my $classobj = Fault::DebugPrinter->new (1); my $didprint = Fault::DebugPrinter->dbg1 ("This will print"); $didprint = Fault::DebugPrinter->dbg (2, "This will not"); my $curlvl = Fault::DebugPrinter->level; $curlvl = $classobj->level ($curlvl+1); $didprint = Fault::DebugPrinter->dbg (2, "This will now"); $classobj = Fault::DebugPrinter->new; $didprint = Fault::DebugPrinter->dbg1 ("This is Disabled."); $curlvl = Fault::DebugPrinter->level (1); $didprint = Fault::DebugPrinter->dbg1 ("This is Enabled.");
level Highest level of Diagnostic message that will be printed.
Generate the DebugPrinter object if it doesn't already exist; otherwise just return the existing class object.
$level will turn diagnostic printing on for messages with a debug level above the specified it or off it is zero. If the argument is not present or undef the current level is set to zero so that, diagnostic printing is disabled.
Single argument Diagnostic printer method. It prints $msg to stdout and returns true if the current debug level is greater than zero. If the $msg argument was missing or undef, it prints "<Null diagnostic message>" so you at least know it tried.
Dual argument Diagnostic printer method. It prints $msg to stdout and returns true if the current debug level is greater than zero and at least equal to the integer value contained in $level. If the $level argument is missing or undef, it is defaulted to Level 1. If the $msg argument was missing or undef, it prints "<Null diagnostic message>" so you at least know it tried.
Set the current diagnostic level to $level. If the $level argument is missing or undef, the current level is unchanged. The no-argument format thus doubles as a 'read current diagnostic level' command.
None
None.
See TODO.
Dale Amon <amon@vnl.com>
1 POD Error
The following errors were encountered while parsing the POD:
=back doesn't take any parameters, but you said =back 4
To install Fault::Msg, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Fault::Msg
CPAN shell
perl -MCPAN -e shell install Fault::Msg
For more information on module installation, please visit the detailed CPAN module installation guide.