HTML::...::Token(3pm)

πŸ“¦
version 3.16 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– HTML::TokeParser::Simple::Token πŸ’–

okay bestie, so this is the base class for all the HTML::TokeParser::Simple tokens, from the User Contributed Perl Documentation section of the perl man pages (yes, 3pm, the perl module girlies know 🫢).


✨ NAME ✨

HTML::TokeParser::Simple::Token β€” it's literally the base class for HTML::TokeParser::Simple tokens. that's the whole job description. periodt. πŸ’…


🌸 SYNOPSIS 🌸

here's the vibe, copy it exactly bestie:

use HTML::TokeParser::Simple;
my $p = HTML::TokeParser::Simple->new( $somefile );

while ( my $token = $p->get_token ) {
    # This prints all text in an HTML doc (i.e., it strips the HTML)
    next unless $token->is_text;
    print $token->as_is;
}

like… the comment says it all: this prints all text in an HTML doc, i.e. it strips the HTML. we love a one-line glow-up ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so. this is the base class for all returned tokens. and the way it is NOT for you to use directly. like, do not instantiate it. it should never be instantiated directly.

and it's not just a suggestion bestie 😭 if you try it, it will literally croak() at you. it said what it said. no cap.

πŸ‘‘ METHODS πŸ‘‘

the following list of methods are provided by this class. and ngl, most of these are stub methods β€” meaning they're placeholders that must be overridden in a subclass. so if you're like "why isn't this doing anything", that's why. go look at HTML::TokeParser::Simple for descriptions of these methods, it's all there 🫢

  • as_is
  • delete_attr
  • get_attr
  • get_attrseq
  • get_tag
  • get_token0
  • is_comment
  • is_declaration
  • is_end_tag
  • is_pi
  • is_process_instruction
  • is_start_tag
  • is_tag
  • is_text
  • return_attr
  • return_attrseq
  • return_tag
  • return_text
  • return_token0
  • rewrite_tag
  • set_attr

okay that's the whole page, you ate that πŸ’…βœ¨

and for the cute sign-off: this lil doc is from perl v5.32.1, dated 2021-12-05, filed under HTML::...::Token(3pm) β€” so like, it's vintage but it's still iconic, fr fr. bye bestie, go parse some HTML πŸŒˆπŸŽ€

πŸ“¦ where this page comes from