Debian Codegraph @

upstream/opensuse-tumbleweed/man3/Pod::Simple::PullParserToken.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "Pod::Simple::PullParserToken 3pm"
61 .TH Pod::Simple::PullParserToken 3pm 2026-03-09 "perl v5.42.1" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 Pod::Simple::PullParserToken \-\- tokens from Pod::Simple::PullParser
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 Given a \f(CW$parser\fR that\*(Aqs an object of class Pod::Simple::PullParser
71 (or a subclass)...
72 .PP
73 .Vb 4
74 \& while(my $token = $parser\->get_token) {
75 \& $DEBUG and print STDERR "Token: ", $token\->dump, "\en";
76 \& if($token\->is_start) {
77 \& ...access $token\->tagname, $token\->attr, etc...
78 \&
79 \& } elsif($token\->is_text) {
80 \& ...access $token\->text, $token\->text_r, etc...
81 \&
82 \& } elsif($token\->is_end) {
83 \& ...access $token\->tagname...
84 \&
85 \& }
86 \& }
87 .Ve
88 .PP
89 (Also see Pod::Simple::PullParser)
90 .SH DESCRIPTION
91 .IX Header "DESCRIPTION"
92 When you do \f(CW$parser\fR\->get_token on a Pod::Simple::PullParser, you should
93 get an object of a subclass of Pod::Simple::PullParserToken.
94 .PP
95 Subclasses will add methods, and will also inherit these methods:
96 .ie n .IP $token\->type 4
97 .el .IP \f(CW$token\fR\->type 4
98 .IX Item "$token->type"
99 This returns the type of the token. This will be either the string
100 "start", the string "text", or the string "end".
101 .Sp
102 Once you know what the type of an object is, you then know what
103 subclass it belongs to, and therefore what methods it supports.
104 .Sp
105 Yes, you could probably do the same thing with code like
106 \&\f(CW$token\fR\->isa(\*(AqPod::Simple::PullParserEndToken\*(Aq), but that\*(Aqs not so
107 pretty as using just \f(CW$token\fR\->type, or even the following shortcuts:
108 .ie n .IP $token\->is_start 4
109 .el .IP \f(CW$token\fR\->is_start 4
110 .IX Item "$token->is_start"
111 This is a shortcut for \f(CW\*(C`$token\->type() eq "start"\*(C'\fR
112 .ie n .IP $token\->is_text 4
113 .el .IP \f(CW$token\fR\->is_text 4
114 .IX Item "$token->is_text"
115 This is a shortcut for \f(CW\*(C`$token\->type() eq "text"\*(C'\fR
116 .ie n .IP $token\->is_end 4
117 .el .IP \f(CW$token\fR\->is_end 4
118 .IX Item "$token->is_end"
119 This is a shortcut for \f(CW\*(C`$token\->type() eq "end"\*(C'\fR
120 .ie n .IP $token\->dump 4
121 .el .IP \f(CW$token\fR\->dump 4
122 .IX Item "$token->dump"
123 This returns a handy stringified value of this object. This
124 is useful for debugging, as in:
125 .Sp
126 .Vb 4
127 \& while(my $token = $parser\->get_token) {
128 \& $DEBUG and print STDERR "Token: ", $token\->dump, "\en";
129 \& ...
130 \& }
131 .Ve
132 .SH "SEE ALSO"
133 .IX Header "SEE ALSO"
134 My subclasses:
135 Pod::Simple::PullParserStartToken,
136 Pod::Simple::PullParserTextToken, and
137 Pod::Simple::PullParserEndToken.
138 .PP
139 Pod::Simple::PullParser and Pod::Simple
140 .SH SUPPORT
141 .IX Header "SUPPORT"
142 Questions or discussion about POD and Pod::Simple should be sent to the
143 pod\[email protected] mail list. Send an empty email to
144 pod\-people\[email protected] to subscribe.
145 .PP
146 This module is managed in an open GitHub repository,
147 <https://github.com/perl\-pod/pod\-simple/>. Feel free to fork and contribute, or
148 to clone <https://github.com/perl\-pod/pod\-simple.git> and send patches!
149 .PP
150 Patches against Pod::Simple are welcome. Please send bug reports to
151 <bug\-pod\[email protected]>.
152 .SH "COPYRIGHT AND DISCLAIMERS"
153 .IX Header "COPYRIGHT AND DISCLAIMERS"
154 Copyright (c) 2002 Sean M. Burke.
155 .PP
156 This library is free software; you can redistribute it and/or modify it
157 under the same terms as Perl itself.
158 .PP
159 This program is distributed in the hope that it will be useful, but
160 without any warranty; without even the implied warranty of
161 merchantability or fitness for a particular purpose.
162 .SH AUTHOR
163 .IX Header "AUTHOR"
164 Pod::Simple was created by Sean M. Burke <[email protected]>.
165 But don\*(Aqt bother him, he\*(Aqs retired.
166 .PP
167 Pod::Simple is maintained by:
168 .IP \(bu 4
169 Allison Randal \f(CW\*(C`[email protected]\*(C'\fR
170 .IP \(bu 4
171 Hans Dieter Pearcey \f(CW\*(C`[email protected]\*(C'\fR
172 .IP \(bu 4
173 David E. Wheeler \f(CW\*(C`[email protected]\*(C'\fR