Smart::Comments - Comments that come to life
This document describes version 0.01 of Smart::Comments, released September 28, 2004.
use Smart::Comments; my $x = 1; my $y = 2; sub is_odd { $_[0] % 2 } ### require: $x > $y ### require: is_odd($y) for (my $j=500; $j>0; $j--) { ### Compiling===[%] done select undef, undef, undef, 0.01; }
This module filters your source code, turning any comments beginning with ### into code that interacts with the rest of the program.
###
To remove this effect, simple remove the use Smart::Comments line, and the original code will run with no speed penalty at all. You may also turn off the filtering lexically, using no Smart::Comments.
use Smart::Comments
no Smart::Comments
Here are some more examples of how this module works:
while (<>) { ### Loading $_ sleep 1; } my $i = 10; while ($i-- > 0) { ### Preparing-----> sleep 1; } ### i now: $i for my $j (1..500) { ### Compiling===[%] done select undef, undef, undef, 0.01; } %foo = ( a=>{foo=>'bar'}, b=>[1..5] ); ### %foo for (1..25) { ### Loading... done sleep 1; } ### check: keys(%foo) == 2 ### require: keys(%foo) == 3
Currently, there are no meaningful tests and documentation for this module. Contributions will be very much appreciated.
Fix line numbering problem (i.e. last message in the example above).
Add line numbers to non-progress-bar reports.
Damian Conway (damian@conway.org)
Autrijus Tang <autrijus@autrijus.org>, Brian Ingerson <INGY@cpan.org>.
Copyright (c) 2004, Damian Conway. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
To install Smart::Comments, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Smart::Comments
CPAN shell
perl -MCPAN -e shell install Smart::Comments
For more information on module installation, please visit the detailed CPAN module installation guide.