PPI::St...ompound(3)
β¨ NAME β¨
okay so bestie, this page is PPI::Statement::Compound β it's the module that describes all compound statements π
(and yes the manpage name got truncated to PPI::St...ompound(3) which is giving β¨mysteryβ¨ but it's fr fr PPI::Statement::Compound from User Contributed Perl Documentation, iykyk).
πΈ SYNOPSIS πΈ
# A compound if statement
if ( foo ) {
bar();
} else {
baz();
}
# A compound loop statement
foreach ( @list ) {
bar($_);
}
like... look at her go π«Ά she's compounding. iconic behavior.
π¦ INHERITANCE π¦
PPI::Statement::Compound
isa PPI::Statement
isa PPI::Node
isa PPI::Element
the family tree ate, no cap π she's a PPI::Statement, which is a PPI::Node, which is a PPI::Element. periodt.
π DESCRIPTION π
PPI::Statement::Compound objects are the little narrators that describe all current forms of compound statements, exactly as laid out in perlsyn.
so what's covered? blocks using if, unless, for, foreach, while, and continue. that's the squad π
but bestie, listen, two things are NOT covered:
- "simple" statements with trailing conditions β nope, not her.
dois also not part of a compound statement. like, at all. π
watch:
# This is NOT a compound statement
my $foo = 1 if $condition;
# This is also not a compound statement
do { ... } until $condition;
see how they look like they're in the group chat but they never actually joined?? π not compound. moving on.
π METHODS π
PPI::Statement::Compound has a bunch of methods on top of the standard PPI::Statement, PPI::Node and PPI::Element methods. she's doing overtime π
β type β
the type method returns the syntactic type of the compound statement.
there are four basic compound statement types:
- the
iftype includes all variations of the if and unless statements β including anyelsiforelseparts of the compound statement. the whole polycule, together π«Ά - the
whiletype describes the standard while and until statements β but again, does not describe simple statements with a trailing while. (we said what we said.) - the
fortype covers the C-styleforloops, regardless of whether they were declared usingfororforeach. she doesn't care about your label, she cares about your vibe. - the
foreachtype covers loops that iterate over collections, regardless of whether they were declared usingfororforeach. same energy, opposite direction.
and every single compound out there is just a variation on one of these four. that's the whole taxonomy, slay.
returns the simple string 'if', 'for', 'foreach' or 'while' β or undef if the type cannot be determined π (she's mysterious like that sometimes).
π TO DO π
- Write unit tests for this package
(one item. one. it's been sitting there. someone please π₯Ί)
π«Ά SUPPORT π«Ά
See the support section in the main module.
π 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.
ok so like the tiny fine print: this isperl v5.42.0, dated2026-01-17, and the page lives atPPI::St...ompound(3). thanks for coming to my ted talk, mwah πβ¨ go write some unit tests bestie π
π¦ 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