1PPIx::QuoteLike::Token(U3s)er Contributed Perl DocumentatPiPoInx::QuoteLike::Token(3)
2
3
4

NAME

6       PPIx::QuoteLike::Token - Represent any token.
7

SYNOPSIS

9       This is an abstract class, and should not be instantiated by the user.
10

DESCRIPTION

12       This Perl module represents the base of the token hierarchy.
13

INHERITANCE

15       "PPIx::QuoteLike::Token" is not descended from any other class.
16
17       "PPIx::QuoteLike::Token" is the parent of
18       PPIx::QuoteLike::Token::Control, PPIx::QuoteLike::Token::Interpolation,
19       PPIx::QuoteLike::Token::String, PPIx::QuoteLike::Token::Structure,
20       PPIx::QuoteLike::Token::Unknown and PPIx::QuoteLike::Token::Whitespace.
21

METHODS

23       This class supports the following public methods:
24
25   column_number
26       This method returns the column number of the first character in the
27       element, or "undef" if that can not be determined.
28
29   content
30        say $token->content();
31
32       This method returns the text that makes up the token.
33
34   error
35        say $token->error();
36
37       This method returns the error text. This will be "undef" unless the
38       token actually represents an error.
39
40   line_number
41       This method returns the line number of the first character in the
42       element, or "undef" if that can not be determined.
43
44   location
45       This method returns a reference to an array describing the position of
46       the element in the string, or "undef" if the location is unavailable.
47
48       The array is compatible with the corresponding PPI::Element method.
49
50   logical_filename
51       This method returns the logical file name (taking "#line" directives
52       into account) of the file containing first character in the element, or
53       "undef" if that can not be determined.
54
55   logical_line_number
56       This method returns the logical line number (taking "#line" directives
57       into account) of the first character in the element, or "undef" if that
58       can not be determined.
59
60   parent
61        my $parent = $token->parent();
62
63       This method returns the token's parent, which will be the
64       PPIx::QuoteLike object that contains it.
65
66   next_sibling
67        my $next = $token->next_sibling();
68
69       This method returns the token after the invocant, or nothing if there
70       is none.
71
72   perl_version_introduced
73       This method returns the version of Perl in which the element was
74       introduced. This will be at least 5.000. Before 5.006 I am relying on
75       the perldelta, perlre, and perlop documentation, since I have been
76       unable to build earlier Perls. Since I have found no documentation
77       before 5.003, I assume that anything found in 5.003 is also in 5.000.
78
79       Since this all depends on my ability to read and understand masses of
80       documentation, the results of this method should be viewed with
81       caution, if not downright skepticism.
82
83       There are also cases which are ambiguous in various ways. For those see
84       "RESTRICTIONS" in PPIx::Regexp, and especially "Changes in Syntax" in
85       PPIx::Regexp.
86
87   perl_version_removed
88       This method returns the version of Perl in which the element was
89       removed. If the element is still valid the return is "undef".
90
91       All the caveats to perl_version_introduced() apply here also, though
92       perhaps less severely since although many features have been introduced
93       since 5.0, few have been removed.
94
95   previous_sibling
96        my $prev = $token->previous_sibling();
97
98       This method returns the token before the invocant, or nothing if there
99       is none.
100
101   significant
102        $token->significant()
103            and say 'significant';
104
105       This Boolean method returns a true value if the token is significant,
106       and a false one otherwise.
107
108   snext_sibling
109        my $next = $token->snext_sibling();
110
111       This method returns the significant token after the invocant, or
112       nothing if there is none.
113
114   sprevious_sibling
115        my $prev = $token->sprevious_sibling();
116
117       This method returns the significant token before the invocant, or
118       nothing if there is none.
119
120   statement
121       This method returns the PPI::Statement that contains this token, or
122       nothing if the statement can not be determined.
123
124       In general this method will return something only under the following
125       conditions:
126
127       •   The token is contained in a PPIx::QuoteLike object;
128
129       •   That object was initialized from a PPI::Element;
130
131       •   The PPI::Element is contained in a statement.
132
133   top
134       This method returns the top of the hierarchy.
135
136   variables
137        say "Interpolates $_" for $elem->variables();
138
139       NOTE that this method is discouraged, and may well be deprecated and
140       removed. My problem with it is that it returns variable names rather
141       than PPI::Element objects, leaving you no idea how the variables are
142       used. It was originally written for the benefit of
143       Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter, but has
144       proven inadequate to that policy's needs.
145
146       This convenience method returns all interpolated variables. Each is
147       returned only once, and they are returned in no particular order.
148
149       NOTE that because this class does not represent an interpolation, this
150       method returns nothing.
151
152   visual_column_number
153       This method returns the visual column number (taking tabs into account)
154       of the first character in the element, or "undef" if that can not be
155       determined.
156

SEE ALSO

158       PPIx::QuoteLike.
159

SUPPORT

161       Support is by the author. Please file bug reports at
162       <https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-QuoteLike>,
163       <https://github.com/trwyant/perl-PPIx-QuoteLike/issues>, or in
164       electronic mail to the author.
165

AUTHOR

167       Thomas R. Wyant, III wyant at cpan dot org
168
170       Copyright (C) 2016-2022 by Thomas R. Wyant, III
171
172       This program is free software; you can redistribute it and/or modify it
173       under the same terms as Perl 5.10.0. For more details, see the full
174       text of the licenses in the directory LICENSES.
175
176       This program is distributed in the hope that it will be useful, but
177       without any warranty; without even the implied warranty of
178       merchantability or fitness for a particular purpose.
179
180
181
182perl v5.34.0                      2022-03-22         PPIx::QuoteLike::Token(3)
Impressum