Skip to content

TFBW/Debug-Comments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Debug::Comments

CPAN version License

Perl source filter which turns comments into debug messages

This module is a minimalist Perl source filter which converts designated comments into debug trace messages printed via warn(). The behaviour is normally activated by an environment variable (e.g. "DEBUG") in a "use if" pragma. In the absence of the source filter, the comments are just comments, so using the module does not create a dependency on it except to the extent you want to run it with debug output.

Synopsis

use if $ENV{DEBUG}, 'Debug::Comments';
#@! This is a debug message. DEBUG=$ENV{DEBUG}

Key Features

  • No cost when disabled - Without the filter, debug messages are just comments
  • Trace info - Messages have a standard time/file/line prefix
  • ANSI color - Prefix is visually distinct if STDERR is a TTY (unless disabled)
  • Configurable - Env vars for controlling output

Installation

cpanm Debug::Comments

Requirements

  • Perl 5.10+
  • Filter::Util::Call

License

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Author

Brett Watson

See Also

About

Perl source filter which can make comments produce log messages.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages