1PPI::Token::Comment(3)User Contributed Perl DocumentationPPI::Token::Comment(3)
2
3
4
6 PPI::Token::Comment - A comment in Perl source code
7
9 PPI::Token::Comment
10 isa PPI::Token
11 isa PPI::Element
12
14 # This is a PPI::Token::Comment
15
16 print "Hello World!"; # So it this
17
18 $string =~ s/ foo # This, unfortunately, is not :(
19 bar
20 /w;
21
23 In PPI, comments are represented by "PPI::Token::Comment" objects.
24
25 These come in two flavours, line comment and inline comments.
26
27 A "line comment" is a comment that stands on its own line. These com‐
28 ments hold their own newline and whitespace (both leading and trailing)
29 as part of the one "PPI::Token::Comment" object.
30
31 An inline comment is a comment that appears after some code, and con‐
32 tinues to the end of the line. This does not include whitespace, and
33 the terminating newlines is considered a separate PPI::Token::White‐
34 space token.
35
36 This is largely a convenience, simplifying a lot of normal code relat‐
37 ing to the common things people do with comments.
38
39 Most commonly, it means when you "prune" or "delete" a comment, a line
40 comment disappears taking the entire line with it, and an inline com‐
41 ment is removed from the inside of the line, allowing the newline to
42 drop back onto the end of the code, as you would expect.
43
44 It also means you can move comments around in blocks much more easily.
45
46 For now, this is a suitably handy way to do things. However, I do
47 reserve the right to change my mind on this one if it gets dangerously
48 anachronistic somewhere down the line.
49
51 Only very limited methods are available, beyond those provided by our
52 parent PPI::Token and PPI::Element classes.
53
54 line
55
56 The "line" accessor returns true if the "PPI::Token::Comment" is a line
57 comment, or false if it is an inline comment.
58
60 See the support section in the main module.
61
63 Adam Kennedy <adamk@cpan.org>
64
66 Copyright 2001 - 2006 Adam Kennedy.
67
68 This program is free software; you can redistribute it and/or modify it
69 under the same terms as Perl itself.
70
71 The full text of the license can be found in the LICENSE file included
72 with this module.
73
74
75
76perl v5.8.8 2006-09-23 PPI::Token::Comment(3)