Skip to content
A Perl diagnostic debug package.
Perl
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Debug.pm
Debug.pod
README.md
debug.pl
dtest.pl
dtest.pm

README.md

Debug.pm

Debug - Perl extension for placing "debug" messages throughout your code, which will be displayed - if enabled - to STDERR at program termination.

Synopsis

use Debug;

Description

  • debuglog() function

This enables or disables debug output. Usually at the "top" of the code.

Debug::debuglog(1);

Passing 0 disables debug output - which can occur anytime after being enabled.

  • debug() function

This is the "diagnostic" creation function. It is passed a variable whose value is wanted to "be checked" or otherwise examined.

The "diagnostic" part of the output is the "two back" back trace, something like:

(debug.pl,39,funca)(debug.pl,43,funcb) b

which is sub funcb called by sub funca with a scalar.

References will be needed to display non-scalars properly. For example:

my %k = ('key',1);
Debug::debug(\%k);

Output would be like:

(debug.pl,24,-) {'key'=>1}

(A single back trace means debug() was in "main".)

See Also

Copyright

Copyright (C) 2018 by Andova Begarin

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.22.3 or, at your option, any later version of Perl 5 you may have available.

You can’t perform that action at this time.