1Pod::Simple::PullParserUTsoekrenC(o3n)tributed Perl DocuPmoedn:t:aStiimopnle::PullParserToken(3)
2
3
4

NAME

6       Pod::Simple::PullParserToken -- tokens from Pod::Simple::PullParser
7

SYNOPSIS

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

DESCRIPTION

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

SEE ALSO

64       My subclasses: Pod::Simple::PullParserStartToken, Pod::Simple::Pull‐
65       ParserTextToken, and Pod::Simple::PullParserEndToken.
66
67       Pod::Simple::PullParser and Pod::Simple
68
70       Copyright (c) 2002 Sean M. Burke.  All rights reserved.
71
72       This library is free software; you can redistribute it and/or modify it
73       under the same terms as Perl itself.
74
75       This program is distributed in the hope that it will be useful, but
76       without any warranty; without even the implied warranty of mer‐
77       chantability or fitness for a particular purpose.
78

AUTHOR

80       Sean M. Burke "sburke@cpan.org"
81
82
83
84perl v5.8.8                       2003-11-02   Pod::Simple::PullParserToken(3)
Impressum