Pod::S...rToken(3perl)
π Pod::Simple::PullParserToken β the whole vibe π
okay bestie, so this is a page from the Perl Programmers Reference Guide β yes, that 3perl energy, we're in the perl manpage section, iconic β and it's all about Pod::Simple::PullParserToken, aka tokens from Pod::Simple::PullParser. β¨ little shiny nuggets of Pod that your parser hands you one at a time. let's get into it π«Ά
πΈ NAME πΈ
Pod::Simple::PullParserToken β tokens from Pod::Simple::PullParser. that's it, that's the name, slay π
π SYNOPSIS π
so picture this: you've got a $parser that's an object of class Pod::Simple::PullParser (or a subclass of it, we love a subclass)... and then you go:
while(my $token = $parser->get_token) {
$DEBUG and print STDERR "Token: ", $token->dump, "\n";
if($token->is_start) {
...access $token->tagname, $token->attr, etc...
} elsif($token->is_text) {
...access $token->text, $token->text_r, etc...
} elsif($token->is_end) {
...access $token->tagname...
}
}
and that's literally the whole loop, bestie. tokens until there are no more tokens. π
(also like, go look at Pod::Simple::PullParser too, iykyk π¦)
π DESCRIPTION π
when you do $parser->get_token on a Pod::Simple::PullParser, you should get an object of a subclass of Pod::Simple::PullParserToken. that's the deal, no cap. β¨
subclasses will add methods (main character energy, they're each a little special), and they'll also inherit these methods right here, which are the shared ones every token gets:
$token->typeβ this hands you back the type of the token. it's gonna be either the string"start", the string"text", or the string"end". π
so once you know the type of an object, you know which subclass it belongs to, and therefore you know which methods it supports. the way that this is basically a personality quiz for objects. π
yes, you could probably do the same thing with code like $token->isa('Pod::Simple::PullParserEndToken'), but honestly that's not so pretty as just using $token->type, or even the following shortcuts, which are giving β¨effortlessβ¨:
$token->is_startβ this is a shortcut for$token->type() eq "start"π«Ά$token->is_textβ this is a shortcut for$token->type() eq "text"π«Ά$token->is_endβ this is a shortcut for$token->type() eq "end"π«Ά$token->dumpβ this returns a handy stringified value of this object. lowkey so useful for debugging, as in:
while(my $token = $parser->get_token) {
$DEBUG and print STDERR "Token: ", $token->dump, "\n";
...
}
ngl a well-placed dump has saved many a debugging session. π₯
π¦ SEE ALSO π¦
my subclasses, aka the token-verse, the squad: Pod::Simple::PullParserStartToken, Pod::Simple::PullParserTextToken, and Pod::Simple::PullParserEndToken. πΈ
also: Pod::Simple::PullParser and Pod::Simple π
π SUPPORT π
got questions or wanna discuss POD and Pod::Simple? send them to the pod-people@perl.org mail list. to subscribe, send an empty email to pod-people-subscribe@perl.org. yes literally empty. not even a "hi". π
this module is managed in an open GitHub repository, <https://github.com/perl-pod/pod-simple/>. feel free to fork and contribute, or to clone <https://github.com/perl-pod/pod-simple.git> and send patches! π
patches against Pod::Simple are welcome. please send bug reports to <bug-pod-simple@rt.cpan.org>. π
π COPYRIGHT AND DISCLAIMERS π
Copyright (c) 2002 Sean M. Burke.
this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
this program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. so like, it's giving generous but it's not giving guarantees, bestie. π
π AUTHOR π
Pod::Simple was created by Sean M. Burke <sburke@cpan.org>. but don't bother him, he's retired. π respect the legend's peace.
Pod::Simple is maintained by:
- Allison Randal
"allison@perl.org" - Hans Dieter Pearcey
"hdp@cpan.org" - David E. Wheeler
"dwheeler@cpan.org"
and that's the whole page, diva. this was perl v5.44.0, dated 2026-10-17 β thanks for scrolling with me, mwah πβ¨
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms