Debug::CodeBlock - Add DEBUG codeblocks to your code.
Version 0.04
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; }
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.
LNATION, <email at lnation.org>
<email at lnation.org>
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.
bug-debug-codeblock at rt.cpan.org
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)
https://rt.cpan.org/NoAuth/Bugs.html?Dist=Debug-CodeBlock
CPAN Ratings
https://cpanratings.perl.org/d/Debug-CodeBlock
Search CPAN
https://metacpan.org/release/Debug-CodeBlock
This software is Copyright (c) 2022 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Debug::CodeBlock, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Debug::CodeBlock
CPAN shell
perl -MCPAN -e shell install Debug::CodeBlock
For more information on module installation, please visit the detailed CPAN module installation guide.