1MDOM::Token::WhitespaceU(s3e)r Contributed Perl DocumentaMtDiOoMn::Token::Whitespace(3)
2
3
4
6 MDOM::Token::Whitespace - Tokens representing ordinary white space
7
9 MDOM::Token::Whitespace
10 isa MDOM::Token
11 isa MDOM::Element
12
14 As a full "round-trip" parser, MDOM records every last byte in a file
15 and ensure that it is included in the MDOM::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 "MDOM::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 MDOM::Node and MDOM::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
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 MDOM::Token and MDOM::Element classes.
37
38 null
39 Because MDOM 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 MDOM::Token::Pod object.
62
64 See the support section in the main module.
65
67 Adam Kennedy <adamk@cpan.org>
68
70 Copyright 2001 - 2006 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.32.0 2020-07-28 MDOM::Token::Whitespace(3)