GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Acme::Comment(3) User Contributed Perl Documentation Acme::Comment(3)

Acme::Comment

    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

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.

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.

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".

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".

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.

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

    Single-line comments begin with "'".

  • Advsys

    Advsys single-line comments begin with ";".

  • Alan

    Single-line comments start with "--".

  • Algol

    Multi-line comments begin with 'comment' and end with ";".

    NOTE: You should not use Algol with "own_line" set to 0: The source filter will take a ";" to be an ending tag for your comments, regardless of where it is.

  • AWK

    Single-line comments use "#".

  • B

    Multi-line comments use "/*" and "*/".

  • Basic

    Single-line comments begin with "'".

  • Beta

    Multi-line comments use "(*" and "*)".

  • Bliss

    Multi-line comments use "(*" and "*)".

  • Blue

    Single-line comments use either "==" or "--".

  • C

    The default for Acme::Comment is C-style multi-line commenting with "/*" and "*/". However, if you wish to change "one_line" or "own_line", you must explicitly specify the type.

  • C++

    C++ multi-line style uses "/*" and "*/". Single-line uses "//".

  • C#

    C# multi-line style uses "/*" and "*/". Single-line uses "//".

  • Chill

    Multi-line comments use "/*" and "*/".

  • Clean

    Clean multi-line style uses "/*" and "*/". Single-line uses "//".

  • E

    Single-line comments use "#".

  • Eiffel

    Single-line comments start with "--".

  • Elastic

    Elastic multi-line style uses "/*" and "*/". Single-line uses "//".

  • Focal

    Single-line comments start with "comment".

  • Fortran

    Single-line comments use "!".

  • Guile

    Guile multi-line style uses "/*" and "*/". Single-line uses "//".

  • Haskell

    Single-line comments start with "--".

  • HTML

    HTML style has multi-line commenting in the form of "<!--" and "-->".

  • Hugo

    Multi-line comments begin with "!\" and end with "\!". Single-line comments are not implemented due to their similarity with multi-line comments.

  • Icon

    Single-line comments use "#".

  • Intercal

    Single-line comments are marked with "DO NOTE THAT" and may optionally be preceded by a line number in the following syntax: "(23) DO NOTE THAT".

  • Java

    Java multi-line style uses "/*" and "*/". Single-line uses "//".

  • Joy

    Multi-line comments use "(*" and "*)".

  • LaTeX

    Single-line comments use "%".

  • LISP

    LISP single-line comments begin with ";".

  • Orthogonal

    Orthogonal single-line comments begin with ";".

  • Parrot

    Single-line comments use "#".

  • Pascal

    Multi-line comments use "(*" and "*)".

  • Perl

    Single-line comments use "#".

  • PHP

    PHP multi-line style uses "/*" and "*/". Single-line uses "//".

  • Pilot

    Single-line comments in the syntax "\/\/" are supported.

  • PL/I

    Multi-line comments use "/*" and "*/".

  • PostScript

    Single-line comments use "%".

  • Python

    Single-line comments use "#".

  • Ruby

    Ruby multi-line comments begin with "=begin" and end with "=end". Single-line comments use "#".

  • Scheme

    Scheme single-line comments begin with ";".

  • Unlambda

    Single-line comments use "#".

  • Var'aq

    Multi-line comments use "(*" and "*)".

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

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.

Thanks to Abigail and Glenn Maciag for their suggestions.

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

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

This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.
2009-10-10 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.