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 (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