1PPI::Token::Comment(3)User Contributed Perl DocumentationPPI::Token::Comment(3)
2
3
4

NAME

6       PPI::Token::Comment - A comment in Perl source code
7

INHERITANCE

9         PPI::Token::Comment
10         isa PPI::Token
11             isa PPI::Element
12

SYNOPSIS

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

DESCRIPTION

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
28       comments hold their own newline and whitespace (both leading and
29       trailing) as part of the one "PPI::Token::Comment" object.
30
31       An inline comment is a comment that appears after some code, and
32       continues to the end of the line. This does not include whitespace, and
33       the terminating newlines is considered a separate
34       PPI::Token::Whitespace token.
35
36       This is largely a convenience, simplifying a lot of normal code
37       relating 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
41       comment 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

METHODS

51       Only very limited methods are available, beyond those provided by our
52       parent PPI::Token and PPI::Element classes.
53
54   line
55       The "line" accessor returns true if the "PPI::Token::Comment" is a line
56       comment, or false if it is an inline comment.
57

SUPPORT

59       See the support section in the main module.
60

AUTHOR

62       Adam Kennedy <adamk@cpan.org>
63
65       Copyright 2001 - 2011 Adam Kennedy.
66
67       This program is free software; you can redistribute it and/or modify it
68       under the same terms as Perl itself.
69
70       The full text of the license can be found in the LICENSE file included
71       with this module.
72
73
74
75perl v5.16.3                      2011-02-26            PPI::Token::Comment(3)
Impressum