CPAN LINK: Acme::Comment
CPAN ABSTRACT: This module allows for multi-line comments which are filtered out. Unlike the pseudo multi-line comment if (0) {}, the code being commented.
Introduction:
Roaming about the monastery I came upon the following node:
Block Commenting, a fellow monk essentially searching for advise on the possibilty of multi-line commenting. A few replies down mentioned in passing the module Acme::Comment, it's claim was to allow multi-line comments which are filtered out. I became curious so I downloaded the module and checked it out for myself.
Functionality:
Acme::Comment, in a nutshell, allows for multi-line and single line commenting in several different language styles. Some of the multi-line comment language styles are: C++, HTML, Pascal and Java to name a few. In total, both single and multi line together there were a total of 43
different programming languages represented. I tested it out in "HTML" mode
using multi-line comments with ActivePerl 5.8.0 on WinXP,
and it proved to be quite easy to use. The distribution itself contains fairly straight forward documentation.
Generic Example:
#!/usr/bin/perl -w
use strict;
use Acme::Comment type=>'HTML';
<!--
Multi-line comments here.
Everything enclosed in the html
style comment braces is ignored.
-->
my $a=1;
my $b=2;
my $c=$a + $b;
print "$a + $b = $c\n";
Final Thoughts:
For implementation of multi-line comments in various language formats I found this module to be quite useful.
The only drawback that I can immediately see is that this module is not yet widely known. I think multi-line commenting
(a single format of) would be great implemented as a standard
feature in a future version of Perl; perhaps in Perl6? (it can't hurt to hope)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.