C::Blocks::Filter - base package for writing filters for C::Blocks
# If you want to print out the code as it is sent # to the C compiler: use strict; use warnings; use C::Blocks; use C::Blocks::Filter; cblock { ... /* this code will be printed */ } # If you want to write your own filter package My::Filter; use C::Blocks::Filter (); our @ISA = qw(C::Blocks::Filter); sub c_blocks_filter { # Modify $_ directly. Allow a new 'keyword' # called 'loop': s/loop/for/g; } # Then in another bit of code using this: use strict; use warnings; use C::Blocks; use My::Filter; cblock { int i; for (i = 0; i < 10; i++) { printf("i = %d\n", i); } loop (i = 0; i < 10; i++) { printf("i = %d\n", i); } }
To install C::Blocks, copy and paste the appropriate command in to your terminal.
cpanm
cpanm C::Blocks
CPAN shell
perl -MCPAN -e shell install C::Blocks
For more information on module installation, please visit the detailed CPAN module installation guide.