NAME
Debug::CodeBlock - Add DEBUG codeblocks to your code.
VERSION
Version 1.00
SYNOPSIS
Quick summary of what the module does.
Use %ENV and set DEBUG_PERL=1
package House;
sub rooms {
my $rooms = model('House')->get_rooms();
DEBUG {
print Dump({ struct => { ... } });
print "The house has ${rooms} rooms.";
}
return $rooms;
}
... or you can define a DEBUG_ENABLED function in your package
package House;
our $DEBUG = 1;
sub DEBUG_ENABLED { $DEBUG }
sub rooms {
my $rooms = model('House')->get_rooms();
DEBUG {
print Dump({ struct => { ... } });
print "The house has ${rooms} rooms.";
}
return $rooms;
}
EXPORT
DEBUG
A codeblock that is only called if DEBUG_PERL is set in %ENV or you have a DEBUG_ENABLED function which returns true. It's pupose is to add debugging logic to your code without it being executed in production.
A Dump function, which is an alias for Data::Dumper::Dumper, is also imported IF debug is enabled and a DEBUG codeblock is found. NOTE: you must use parenthesis as it is imported at runtime.
AUTHOR
LNATION, <email at lnation.org>
BUGS
Please report any bugs or feature requests to bug-debug-codeblock at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Debug-CodeBlock. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Debug::CodeBlock
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2022 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)