PPI::To...rototype(3)
β¨ NAME β¨
PPI::Token::Prototype β bestie, it's a subroutine prototype descriptor π
Like, the manual page you're reading is PPI::To...rototype(3), and this class is the whole vibe.
π¦ INHERITANCE π¦
The family tree, no cap:
PPI::Token::Prototype
isa PPI::Token::Quote::Literal
isa PPI::Token::Quote
isa PPI::Token
isa PPI::Element
So she's a PPI::Token::Quote::Literal at heart, which is a PPI::Token::Quote, which is a PPI::Token, which is a PPI::Element. Iconic lineage honestly π
πΈ SYNOPSIS πΈ
sub ($@) prototype;
That's it. That's the whole moment β¨
π DESCRIPTION π
Okay so real talk: even though a subroutine prototype lowkey looks like a list or a condition, she is so much more like a string. Her whole job is giving hints to the perl compiler about what type of arguments a particular subroutine expects. The compiler then uses those hints to validate parameters at compile-time, and it also lets programmers call the functions without explicit parameter parens. Slay π
Because OO Perl coding took over and OO Perl just ignores prototypes, these days prototypes are mostly used to allow for constant-like things, and to "extend" the language by creating things that act like keywords and core functions. Main character energy fr fr π«Ά
# Create something that acts like a constant
sub MYCONSTANT () { 10 }
# Create the "any" core-looking function
sub any (&@) { ... }
if ( any { $_->cute } @babies ) {
...
}
π METHODS π
This class provides one additional method beyond those defined by the PPI::Token and PPI::Element parent classes. Just the one. She's focused like that π
π prototype
The "prototype" accessor returns the actual prototype pattern, stripped of flanking parens and of all whitespace. This mirrors the behavior of the Perl "prototype" builtin function.
Note that stripping parens and whitespace means that the return of "prototype" can be an empty string. Yes bestie, an empty string is a whole valid outcome π
π SUPPORT π
See the support section in the main module. Go look, iykyk π
π AUTHOR π
Adam Kennedy <adamk@cpan.org>
π COPYRIGHT π
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.
okay that's the whole page, bestie!! this was perl v5.42.0, dated 2026-01-17, and the manual page is PPI::To...rototype(3) π¦β¨ mwah, go write some prototypes π
π
π¦ where this page comes from
- fedora 44: perl-PPI 1.284-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms