Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Acme::Comment

by PERLscienceman (Curate)
on Nov 06, 2003 at 03:07 UTC ( #304932=modulereview: print w/ replies, xml ) Need Help??

Item Description: Allows multi-line comments which are filtered out.

Review Synopsis:

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)

Comment on Acme::Comment
Download Code
Re: Acme::Comment -- Module Review
by Abigail-II (Bishop) on Nov 06, 2003 at 11:50 UTC
    Unfortunally, Acme::Comment contains bugs. I tried HTML comments as well, and using perfectly valid HTML comment syntax I wrote:
    #!/usr/bin/perl use strict; use warnings; use Acme::Comment type => 'HTML'; use Regexp::Common; $_ = `cat $0`; print "Found HTML regex:\n$_\n" for /($RE{comment}{HTML})/g; <!-- -- --> die "It's all attributed to human error, Dave\n"; <!-- -- --> print "Ok\n"; __END__ Found HTML regex: <!-- -- --> die "It's all attributed to human error, Dave\n"; <!-- -- --> It's all attributed to human error, Dave

    Abigail

      Hasn't that silly version of the comment definition died yet? (: Everyone not obsessed with reading official standards knows that HTML comments simply start with <!-- and simply end with -->. I'm surprised you didn't demonstrate whitespace between the -- and the >.

      In my experience, the facts of the HTML standard on this point usually lose to the much simpler common misconception of what an HTML comment is. And I'd be quite surprised to find a web page that used a comment that included --> in the middle.

      If I found the real definition of the HTML comment technically preferrable (or if I didn't feel that the tide had already turned on this), I'd probably be fighting for standards conformance. As things stand, I tend to prefer de facto standards conformance on this point (though with a small spark of guilt).

      Note that PerlMonks gets this and one other small point of HTML intentionally wrong to better deal with HTML produced by the wide variety of users typing it in "by hand".

                      - tye
        Isn't it odd that when Microsoft decides to ignore standards and make up their own, many people, especially those that participate in the Open Source movement balk loudly, but when it comes to HTML, people blindly follow Netscape and Microsoft into the darkness, cheering all the way?

        Either you endorse open standards, or you don't. There's no middle way.

        Abigail

        P.S. One reason people don't use --> in their comments is that they have to cater for buggy browsers.

Re: Acme::Comment -- Module Review
by jweed (Chaplain) on Nov 07, 2003 at 02:05 UTC
    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)
    It isn't happening. Basically, they're going to try to redo POD so it's all spiffy, but Lwall gives the multi line comment RFC a rejection. So it looks like it isn't going to happen.

    From Apocalypse 2:

    But even if I weren't blindly prejudiced, I suspect I'd look at the psychology of the thing, and notice that much of the time, even in languages that have multiline comments, people nevertheless tend to use them like this:
        /*
         *  Natter, natter, natter.
         *  Gromish, gromish, gromish.
         */
    
    The counterargument to that is, of course, that people don't always do that in C, so why should they have to do it in Perl? And if there were no other way to do multiline comments in Perl, they'd have a stronger case. But there already is another way, albeit one rejected by this RFC as "a workaround."
    (In response to RFC 5)

    Edit by tye, preserve formatting

      Although I must say I find the syntax
      #<<END_COMMENT blah blah blah END_COMMENT
      quite appealing in its consequence. Pity that Acme::Comment doesn't support that style.

      Makeshifts last the longest.

      I strongly agree with Apo2, because I myself never use the /* */ comment and always the C++ // comments (yes I know it's bad).

      Another thing comes to my mind: whenever I want a multiline comment REALLY HARD, it usually proves to be some form of documentation, so I end up writing an inline POD paragraph instead.

      inline POD rules! :)

Back to Reviews

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: modulereview [id://304932]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-10-25 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (143 votes), past polls