The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Inspect::Debug - provides debugging facilities for Net::Inspect library

DESCRIPTION

the following functionality is provided:

debug(msg,[@args])

if $DEBUG is set prints out debugging message, prefixed with "DEBUG" and info about calling function and code line. If @args are given msg is considered and format string which will be combined with @args to the final message.

This function is exported by default.

xdebug(object,...)

Same es debug, but prefixed with object. Usually overwritten in classes to show info about object.

This function can be exported on demand.

trace(msg,[@args])

if $TRACE{'*'} or $TRACE{$$pkg}' is set prints out trace message, prefixed with "[$pkg]". $pkg is the last part of the package name, where trace got called. If @args are given msg is considered and format string which will be combined with @args to the final message.

This function is exported by default.

xtrace(object,...)

Same es trace, but prefixed with object. Usually overwritten in classes to show info about object.

This function can be exported on demand.

$DEBUG

If true debugging messages will be print. Can be explicitly imported, but is not exported by default.

$DEBUG_RX

This variable can contain a regex. If set, only debugging within packages matching the regex will be enabled, but only if c<$DEBUG> is also true.

Can be explicitly imported, but is not exported by default.

%TRACE

If true for '*' or $pkg (see trace) trace messages will be print. Can be explicitly imported, but is not exported by default.

To integrate the debugging of Net::Inspect with other debugging frameworks one has to call one of

  Net::Inspect::Debug var => \$myDEBUG, sub => \&my_debug;
  Net::Inspect::Debug var => \$myDEBUG, output => \&my_output;

as early as possible (before any modules using Net::IMPs debug functionality get loaded).

var => \$myDEBUG

This make the local $DEBUG variable an alias for $myDEBUG. $myDEBUG needs to be a global variable, lexical variables will not work.

sub => \&my_debug

This will call my_debug with the debug message instead of using the builtin implementation.

output => \&my_output

This will call my_output instead of the printing to STDERR done within the internal (x)debug and (x)trace functions.

1;