Net::IMP::Debug provides debugging functions for use inside the Net::IMP packages. It provides a way to debug only some packages and to make the internal debugging use an external debug function for output.

Create a debug message. It can be used with a single $message or sprintf-like with $format and @args.

If message gets dynamically generated in an expensive way, it is better to call debug only if $DEBUG is true, so that the message only gets generated on active debugging.

If no external debug function is set (see below), the function will write the message to STDERR, prefixed with subroutine name and line number. If an external debug function is set, it will call this function with the debug message, maintaining the calling stack (e.g. using goto).