1PPI::Token::Whitespace(U3s)er Contributed Perl DocumentatPiPoIn::Token::Whitespace(3)
2
3
4

NAME

6       PPI::Token::Whitespace - Tokens representing ordinary white space
7

INHERITANCE

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

DESCRIPTION

14       As a full "round-trip" parser, PPI records every last byte in a file
15       and ensure that it is included in the PPI::Document object.
16
17       This even includes whitespace. In fact, Perl documents are seen as
18       "floating in a sea of whitespace", and thus any document will contain
19       vast quantities of "PPI::Token::Whitespace" objects.
20
21       For the most part, you shouldn't notice them. Or at least, you
22       shouldn't have to notice them.
23
24       This means doing things like consistently using the "S for significant"
25       series of PPI::Node and PPI::Element methods to do things.
26
27       If you want the nth child element, you should be using "schild" rather
28       than "child", and likewise "snext_sibling", "sprevious_sibling", and so
29       on and so forth.
30

METHODS

32       Again, for the most part you should really not need to do anything very
33       significant with whitespace.
34
35       But there are a couple of convenience methods provided, beyond those
36       provided by the parent PPI::Token and PPI::Element classes.
37
38   null
39       Because PPI sees documents as sitting on a sort of substrate made of
40       whitespace, there are a couple of corner cases that get particularly
41       nasty if they don't find whitespace in certain places.
42
43       Imagine walking down the beach to go into the ocean, and then quite
44       unexpectedly falling off the side of the planet. Well it's somewhat
45       equivalent to that, including the whole screaming death bit.
46
47       The "null" method is a convenience provided to get some internals out
48       of some of these corner cases.
49
50       Specifically it create a whitespace token that represents nothing, or
51       at least the null string ''. It's a handy way to have some "whitespace"
52       right where you need it, without having to have any actual characters.
53
54   tidy
55       "tidy" is a convenience method for removing unneeded whitespace.
56
57       Specifically, it removes any whitespace from the end of a line.
58
59       Note that this doesn't include POD, where you may well need to keep
60       certain types of whitespace. The entire POD chunk lives in its own
61       PPI::Token::Pod object.
62

SUPPORT

64       See the support section in the main module.
65

AUTHOR

67       Adam Kennedy <adamk@cpan.org>
68
70       Copyright 2001 - 2011 Adam Kennedy.
71
72       This program is free software; you can redistribute it and/or modify it
73       under the same terms as Perl itself.
74
75       The full text of the license can be found in the LICENSE file included
76       with this module.
77
78
79
80perl v5.36.0                      2022-07-22         PPI::Token::Whitespace(3)
Impressum