PPI::Token(3)

πŸ’– PPI::Token β€” bestie edition πŸ’–

okay so this is PPI::Token(3), straight out of the User Contributed Perl Documentation, and it's genuinely one of the cutest little building blocks in the whole PPI universe. let's get into it 🫢


✨ NAME ✨

PPI::Token β€” a single token of Perl source code. like, one lil guy. one atom of your code. iconic behavior honestly 🌸


🌈 INHERITANCE 🌈

the family tree goes like this:

PPI::Token
isa PPI::Element

so yes, a Token is a PPI::Element. it's giving "I inherited my whole personality from my parent class" and honestly? slay πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

PPI::Token is the abstract base class for all Tokens. abstract meaning you don't really instantiate it directly, it's the blueprint, the vibe, the template. the way that every other Token class is like "yes I am one of these" 😌

in PPI terms, a Token is a PPI::Element that directly represents bytes of source code. like, actually literally the characters. the raw text. no cap πŸ“βœ¨


πŸŽ€ METHODS πŸŽ€

πŸ’œ set_content $string

the set_content method lets you set / change the string that the PPI::Token object represents. you're basically telling it "bestie, this is what you are now" πŸ”₯

Returns the string you set the Token to.

πŸ’œ add_content $string

the add_content method lets you tack on additional bytes of code onto the end of the Token. like adding a lil accessory to an already perfect outfit πŸŽ€

Returns the new full string, after the bytes have been added.

πŸ’œ length

the length method returns the length of the string in a Token. that's it. that's the whole method. simple, elegant, underrated πŸ‘‘


🌟 SUPPORT 🌟

see the support section in the main module. (go check it out, it's right there, iykyk 🧚)


πŸ‘‘ AUTHOR πŸ‘‘

Adam Kennedy <adamk@cpan.org> β€” actual legend, fr fr πŸ’–


Copyright 2001 - 2011 Adam Kennedy.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.


🫢 reminder bestie: it's abstract, so don't go trying to use PPI::Token directly, that's not the move. the subclasses are the main characters here πŸ’…

and that's the whole page!! brought to you by perl v5.42.0, dated 2026-01-17, and this lil manpage has been serving PPI::Token(3) energy the entire time. mwah, no notes πŸ’‹βœ¨πŸŒˆ

πŸ“¦ where this page comes from