NAME

Fault::DebugPrinter.pm - A Debug print controller with levels.

SYNOPSIS

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;

Inheritance

Base Class

Description

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.

Examples

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.");

Class Variables

level        Highest level of Diagnostic message that will be printed.

Class Methods

$class_object = Fault::DebugPrinter->new ($level)
$class_object = $class_object->new ($level)
$class_object = Fault::DebugPrinter->new
$class_object = $class_object->new

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.

$didprint = Fault::DebugPrinter->dbg1 ($msg)
$didprint = $class_object->dbg1 ($msg)

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.

$didprint = Fault::DebugPrinter->dbg ($level,$msg)
$didprint = $class_object->dbg ($level,$msg)

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.

$curlvl = Fault::DebugPrinter->level ($level)
$curlvl = $class_object->level ($level)
$curlvl = Fault::DebugPrinter->level
$curlvl = $class_object->level

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.

Instance Methods

None

Private Class Methods

None.

Private Instance Methods

None.

SEE ALSO

None.

AUTHOR

Dale Amon <amon@vnl.com>

1 POD Error

The following errors were encountered while parsing the POD:

Around line 171:

=back doesn't take any parameters, but you said =back 4