Chris Williams > Acme-Comment > Acme::Comment

Download:
Acme-Comment-1.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.04   Source  

NAME ^

Acme::Comment

SYNOPSIS ^

    use Acme::Comment type=>'C++', own_line=>1;

    /*
    if (ref $mod) {
        $bar->{do}->blat(msg => 'blarg');
        eval {

    i'm sooo sick of this time for some coffee

    */

    // I prefer beer.  --sqrn

DESCRIPTION ^

Acme::Comment allows multi-line comments which are filtered out. Unlike the pseudo multi-line comment if (0) {}, the code being commented out need not be syntactically valid.

USE ^

Acme::Comment contains several different commenting styles.

Styles may be specified by the types argument, or by start and end and manipulated with own_line and one_line.

Styles may contain multi-line comments and single-line comments. Perl, for example, has single-line comments in the form of #.

C, on the other hand, has multi-line comments which begin with /* and end with */.

With multi-line comments, leaving out a begin or an end comment will cause an error.

Both types of comments may only be preceded on a line by whitespace.

own_line

By default, own_line is true, which means that multi-line comments may not be followed by any characters other than whitespace on the same line. This is the safest option if you think your code may contain the comment characters (perhaps in a regex). If you disable it, other characters are allowed on the line after the starting delimiter, but these characters will be ignored. The closing delimiter cannot be followed by any other characters.

Thus, in the following example, $foo would be set to 1.

    /* This is my real comment.
    */
    $foo = 1;

If you wish to change this option, you must specify either a type or start and end.

one_line

By default, this is set to false, which means that multi-line comments may not end on the same line in which they begin. Turning this on allows the following syntax:

    /* comment */

If you wish to change this option, you must specify either a type or start and end.

start and end

The start and end arguments allow you to supply your own commenting pattern instead of one of the ones available with type. It is not valid to provide the same pattern for both start and end.

You cannot specify both type and start and end, and start and end must both be provided if you provide one of them.

types

The types argument specifies what language style should be used. Only one language style may be specified.

CAVEATS ^

Because of the way source filters work, it is not possible to eval code containing comments and have them correctly removed.

NOTE ^

Some of these programming languages may be spelled incorrectly, or may have the wrong quote characters noted. The majority of this information was found by searches for language specifications.

So please report errors, as well as obscure commenting syntax you know of.

Acknowledgements ^

Thanks to Abigail and Glenn Maciag for their suggestions.

BUG REPORTS ^

Please report bugs or other issues to <bug-acme-comment@rt.cpan.org>.

AUTHOR ^

This module by Jos Boumans <kane@cpan.org>.

COPYRIGHT ^

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

syntax highlighting: