| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (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 |
.\" |
| 57 |
.IX Title "Pod::Simple::PullParserToken 3perl" |
| 58 |
.TH Pod::Simple::PullParserToken 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
Pod::Simple::PullParserToken \-\- tokens from Pod::Simple::PullParser |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
Given a \f(CW$parser\fR that's an object of class Pod::Simple::PullParser |
| 68 |
(or a subclass)... |
| 69 |
.PP |
| 70 |
.Vb 4 |
| 71 |
\& while(my $token = $parser\->get_token) { |
| 72 |
\& $DEBUG and print STDERR "Token: ", $token\->dump, "\en"; |
| 73 |
\& if($token\->is_start) { |
| 74 |
\& ...access $token\->tagname, $token\->attr, etc... |
| 75 |
\& |
| 76 |
\& } elsif($token\->is_text) { |
| 77 |
\& ...access $token\->text, $token\->text_r, etc... |
| 78 |
\& |
| 79 |
\& } elsif($token\->is_end) { |
| 80 |
\& ...access $token\->tagname... |
| 81 |
\& |
| 82 |
\& } |
| 83 |
\& } |
| 84 |
.Ve |
| 85 |
.PP |
| 86 |
(Also see Pod::Simple::PullParser) |
| 87 |
.SH DESCRIPTION |
| 88 |
.IX Header "DESCRIPTION" |
| 89 |
When you do \f(CW$parser\fR\->get_token on a Pod::Simple::PullParser, you should |
| 90 |
get an object of a subclass of Pod::Simple::PullParserToken. |
| 91 |
.PP |
| 92 |
Subclasses will add methods, and will also inherit these methods: |
| 93 |
.ie n .IP $token\->type 4 |
| 94 |
.el .IP \f(CW$token\fR\->type 4 |
| 95 |
.IX Item "$token->type" |
| 96 |
This returns the type of the token. This will be either the string |
| 97 |
"start", the string "text", or the string "end". |
| 98 |
.Sp |
| 99 |
Once you know what the type of an object is, you then know what |
| 100 |
subclass it belongs to, and therefore what methods it supports. |
| 101 |
.Sp |
| 102 |
Yes, you could probably do the same thing with code like |
| 103 |
\&\f(CW$token\fR\->isa('Pod::Simple::PullParserEndToken'), but that's not so |
| 104 |
pretty as using just \f(CW$token\fR\->type, or even the following shortcuts: |
| 105 |
.ie n .IP $token\->is_start 4 |
| 106 |
.el .IP \f(CW$token\fR\->is_start 4 |
| 107 |
.IX Item "$token->is_start" |
| 108 |
This is a shortcut for \f(CW\*(C`$token\->type() eq "start"\*(C'\fR |
| 109 |
.ie n .IP $token\->is_text 4 |
| 110 |
.el .IP \f(CW$token\fR\->is_text 4 |
| 111 |
.IX Item "$token->is_text" |
| 112 |
This is a shortcut for \f(CW\*(C`$token\->type() eq "text"\*(C'\fR |
| 113 |
.ie n .IP $token\->is_end 4 |
| 114 |
.el .IP \f(CW$token\fR\->is_end 4 |
| 115 |
.IX Item "$token->is_end" |
| 116 |
This is a shortcut for \f(CW\*(C`$token\->type() eq "end"\*(C'\fR |
| 117 |
.ie n .IP $token\->dump 4 |
| 118 |
.el .IP \f(CW$token\fR\->dump 4 |
| 119 |
.IX Item "$token->dump" |
| 120 |
This returns a handy stringified value of this object. This |
| 121 |
is useful for debugging, as in: |
| 122 |
.Sp |
| 123 |
.Vb 4 |
| 124 |
\& while(my $token = $parser\->get_token) { |
| 125 |
\& $DEBUG and print STDERR "Token: ", $token\->dump, "\en"; |
| 126 |
\& ... |
| 127 |
\& } |
| 128 |
.Ve |
| 129 |
.SH "SEE ALSO" |
| 130 |
.IX Header "SEE ALSO" |
| 131 |
My subclasses: |
| 132 |
Pod::Simple::PullParserStartToken, |
| 133 |
Pod::Simple::PullParserTextToken, and |
| 134 |
Pod::Simple::PullParserEndToken. |
| 135 |
.PP |
| 136 |
Pod::Simple::PullParser and Pod::Simple |
| 137 |
.SH SUPPORT |
| 138 |
.IX Header "SUPPORT" |
| 139 |
Questions or discussion about POD and Pod::Simple should be sent to the |
| 140 |
pod\[email protected] mail list. Send an empty email to |
| 141 |
pod\-people\[email protected] to subscribe. |
| 142 |
.PP |
| 143 |
This module is managed in an open GitHub repository, |
| 144 |
<https://github.com/perl\-pod/pod\-simple/>. Feel free to fork and contribute, or |
| 145 |
to clone <https://github.com/perl\-pod/pod\-simple.git> and send patches! |
| 146 |
.PP |
| 147 |
Patches against Pod::Simple are welcome. Please send bug reports to |
| 148 |
<bug\-pod\[email protected]>. |
| 149 |
.SH "COPYRIGHT AND DISCLAIMERS" |
| 150 |
.IX Header "COPYRIGHT AND DISCLAIMERS" |
| 151 |
Copyright (c) 2002 Sean M. Burke. |
| 152 |
.PP |
| 153 |
This library is free software; you can redistribute it and/or modify it |
| 154 |
under the same terms as Perl itself. |
| 155 |
.PP |
| 156 |
This program is distributed in the hope that it will be useful, but |
| 157 |
without any warranty; without even the implied warranty of |
| 158 |
merchantability or fitness for a particular purpose. |
| 159 |
.SH AUTHOR |
| 160 |
.IX Header "AUTHOR" |
| 161 |
Pod::Simple was created by Sean M. Burke <[email protected]>. |
| 162 |
But don't bother him, he's retired. |
| 163 |
.PP |
| 164 |
Pod::Simple is maintained by: |
| 165 |
.IP \(bu 4 |
| 166 |
Allison Randal \f(CW\*(C`[email protected]\*(C'\fR |
| 167 |
.IP \(bu 4 |
| 168 |
Hans Dieter Pearcey \f(CW\*(C`[email protected]\*(C'\fR |
| 169 |
.IP \(bu 4 |
| 170 |
David E. Wheeler \f(CW\*(C`[email protected]\*(C'\fR |