1Pod::Simple::PullParserTPoekreln(P3rpomg)rammers ReferePnocde::GSuiimdpele::PullParserToken(3pm)
2
3
4
6 Pod::Simple::PullParserToken -- tokens from Pod::Simple::PullParser
7
9 Given a $parser that's an object of class Pod::Simple::PullParser (or a
10 subclass)...
11
12 while(my $token = $parser->get_token) {
13 $DEBUG and print "Token: ", $token->dump, "\n";
14 if($token->is_start) {
15 ...access $token->tagname, $token->attr, etc...
16
17 } elsif($token->is_text) {
18 ...access $token->text, $token->text_r, etc...
19
20 } elsif($token->is_end) {
21 ...access $token->tagname...
22
23 }
24 }
25
26 (Also see Pod::Simple::PullParser)
27
29 When you do $parser->get_token on a Pod::Simple::PullParser, you should
30 get an object of a subclass of Pod::Simple::PullParserToken.
31
32 Subclasses will add methods, and will also inherit these methods:
33
34 $token->type
35 This returns the type of the token. This will be either the string
36 "start", the string "text", or the string "end".
37
38 Once you know what the type of an object is, you then know what
39 subclass it belongs to, and therefore what methods it supports.
40
41 Yes, you could probably do the same thing with code like
42 $token->isa('Pod::Simple::PullParserEndToken'), but that's not so
43 pretty as using just $token->type, or even the following shortcuts:
44
45 $token->is_start
46 This is a shortcut for "$token->type() eq "start""
47
48 $token->is_text
49 This is a shortcut for "$token->type() eq "text""
50
51 $token->is_end
52 This is a shortcut for "$token->type() eq "end""
53
54 $token->dump
55 This returns a handy stringified value of this object. This is
56 useful for debugging, as in:
57
58 while(my $token = $parser->get_token) {
59 $DEBUG and print "Token: ", $token->dump, "\n";
60 ...
61 }
62
64 My subclasses: Pod::Simple::PullParserStartToken,
65 Pod::Simple::PullParserTextToken, and Pod::Simple::PullParserEndToken.
66
67 Pod::Simple::PullParser and Pod::Simple
68
70 Questions or discussion about POD and Pod::Simple should be sent to the
71 pod-people@perl.org mail list. Send an empty email to
72 pod-people-subscribe@perl.org to subscribe.
73
74 This module is managed in an open GitHub repository,
75 http://github.com/theory/pod-simple/ <http://github.com/theory/pod-
76 simple/>. Feel free to fork and contribute, or to clone
77 git://github.com/theory/pod-simple.git <git://github.com/theory/pod-
78 simple.git> and send patches!
79
80 Patches against Pod::Simple are welcome. Please send bug reports to
81 <bug-pod-simple@rt.cpan.org>.
82
84 Copyright (c) 2002 Sean M. Burke.
85
86 This library is free software; you can redistribute it and/or modify it
87 under the same terms as Perl itself.
88
89 This program is distributed in the hope that it will be useful, but
90 without any warranty; without even the implied warranty of
91 merchantability or fitness for a particular purpose.
92
94 Pod::Simple was created by Sean M. Burke <sburke@cpan.org>. But don't
95 bother him, he's retired.
96
97 Pod::Simple is maintained by:
98
99 · Allison Randal "allison@perl.org"
100
101 · Hans Dieter Pearcey "hdp@cpan.org"
102
103 · David E. Wheeler "dwheeler@cpan.org"
104
105
106
107perl v5.12.4 2011-06-07 Pod::Simple::PullParserToken(3pm)